Twitter oauth with Expo?

#1

Hi. I just started playing around with Expo. I noticed you provide OAuth sign in for Facebook via your SDK API. I was wondering if Expo would be able to handle Twitter’s 3-legged authorisation? All the client libraries I found require a standalone app and I would like to avoid ejecting at this point.

Is there a way to utilise AuthSession to do what is described here:
https://developer.twitter.com/en/docs/basics/authentication/api-reference/request_token ?

#2

Hi Mischa,

Yeah, I don’t think you’ll need to eject. Here’s an example using Github https://github.com/brentvatne/oauth-examples/blob/master/api/authenticateWithGithubAsync.js

#3

Thanks for your reply thetc.

I think what trips me is the first step for Twitter which requires sending a POST request with consumer key/secret inside the header (https://dev.twitter.com/web/sign-in/implementing). I assume this step needs to happen before the AuthSession? Something like this:

Step 1: POST /oauth/request_token. This can be done in the background by using fetch() without any User interaction.

Step 2. Now use AuthSession for GET oauth / authenticate together with the token obtained from step 1 and follow the redirect to Twitter to allow user to sign in.

Does this make sense?

closed #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.