Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification on auth(tokens, callbackUrl[, options]) #2

Open
srt0422 opened this issue Mar 3, 2017 · 5 comments
Open

Clarification on auth(tokens, callbackUrl[, options]) #2

srt0422 opened this issue Mar 3, 2017 · 5 comments

Comments

@srt0422
Copy link

srt0422 commented Mar 3, 2017

Hello,

I appreciate the time you put into this module. It looks like it will be a big help on my project, but I'm confused about the use of the above method.

according to your "readme" file it returns this "

 Returns: Promise of {accessToken, accessTokenSecret, id, name}

 accessToken Access token
 accessTokenSecret Access token secret
 id User id
 name Screen name

When I call "auth" in my app, it properly redirects to the twitter login page. When I authorize the app, it redirects back to the app, but the ".then" function never gets called.

My code is something like this:

let twitterAccessToken;

auth({tokens, redirectUrl}).then((accessToken)=> twitterAccessToken = accessToken);

@andreyluiz
Copy link

andreyluiz commented Mar 5, 2017

You are probably missing the launchMode attribute on the activity as described here.

You need to add in your AndroidManifest.xml:

<activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    android:windowSoftInputMode="adjustResize"
    android:launchMode="singleTask"> <!-- THIS LINE -->

This will make the browser redirect back right where you called the auth method, in the same app instance, and then the promise will resolve successfully. :)

I hope it helps for your case.

@vinhtq
Copy link

vinhtq commented May 5, 2017

Seem like Linking.addEventListener('url', callback) not working anymore.

@srt0422
Copy link
Author

srt0422 commented May 9, 2017

@andreyluiz
Thanks for the tip. I'll make sure I take care of that on the android version.

I apologize for not clarifying in my post that I'm currently working on the IOS version.

In my case, the problem was that I had to properly setup deep linking, and I have several plugins that handle opening urls in AppDelegate.m. I had to update the code so that they work together properly in the "openurl" method in AppDelagate.m.

The plugin works for me now.

@u-kan
Copy link

u-kan commented May 23, 2017

@srt0422

Hi, thanks for creating issue.

I'm really new to react-native and ios app building, and I do not understand how I can setup Deeplink stuff.

Could you please give me some example??

Thanks for reading!!

@vinhtq
Copy link

vinhtq commented May 24, 2017

@KanUchida Please follow this guide: https://facebook.github.io/react-native/docs/linking.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants