react-native-oauth icon indicating copy to clipboard operation
react-native-oauth copied to clipboard

'authorize' of undefined

Open Surendhar95 opened this issue 8 years ago • 2 comments

I have followed all the steps to setup 'react-native-oauth' for android. I want to create a new provider and authorize my client instance with that provider's server.For this I'm using the addProvider() method given in the doc.

This is the service I have written for the authentication:

`import OAuthManager from 'react-native-oauth';

const manager = new OAuthManager(<app_name>)

manager.addProvider({ 'my_provider': { auth_version: '2.0', authorize_url: , access_token_url: <token_url>, callback_url: 'http://localhost/[my_provider]', //DEEP LINK } });

manager.configure({ my_provider: { client_id: <client_id>, client_secret:<client_secret>, redirect_uri:'http://localhost/[my_provider]' //DEEP LINK } }); module.exports = { authManager: () => {manager.authorize('my_provider') .then(resp => console.log('Your users ID')) .catch(err => console.log(err)); } } `

But I get " 'authorize' of undefined " error when I call the authManager method.Am I doing anything wrong here.

Surendhar95 avatar Oct 24 '17 07:10 Surendhar95

Did you try re-build the project? e,g: react-native run-android`

I assume that you will get an error like

/home/george/workspace/myRNProject/node_modules/react-native-oauth/android/src/main/java/io/fullstack/oauth/OAuthManagerPackage.java:39: error: method does not override or implement a method from a supertype
    @Override
    ^
Note: /home/george/workspace/myRNProject/node_modules/react-native-oauth/android/src/main/java/io/fullstack/oauth/OAuthManagerDialogFragment.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:react-native-oauth:compileReleaseJavaWithJavac FAILED

`just ckeck this issue #156

tavantzo avatar Oct 27 '17 22:10 tavantzo

Apparently the package was not linked properly in android.When I ran react-native link and rebuilt my project,it worked.

Anyway thanks @tavantzo .Cheers

Surendhar95 avatar Nov 02 '17 06:11 Surendhar95