AuthSession with Facebook, Issue in production

#1

Works well in Development (after the development Expo permission step, launches facebook OAuth with data from browser, etc) and in the “published” version of the app. However, it does not work as a standalone app deployed to the Apple / Google Play Stores.

Here is my code:

let redirect = AuthSession.getRedirectUrl()
let result = await AuthSession.startAsync({
authUrl:
https://www.facebook.com/v2.8/dialog/oauth?response_type=token +
&client_id=${{FB_APPID}} +
&redirect_uri=${encodeURIComponent(redirect)},
});

if(result.params.access_token){


}

I have tried setting a scheme in the app.json and using Linking to construct the redirectUrl, as in - Expo.Linking.makeUrl({‘myscheme’}://’). This returns the error “The redirect_url URL is not supported”

Any thoughts or guidance on this is much appreciated. Thanks!

#2

If the redirect uri is the issue here, then this topic is also relevant

Thanks!

#3

Any thoughts on this?

I’m launching an app I built w/ Expo on both the App / Google Play Stores this week, and this is really the last item remaining.

#4

Hi @gme1108 - sorry for the lack of a response on our end. You do need to set a scheme in your app.json (and make a new build after setting this), but using the default AuthSession.getRedirectUrl() should work just fine – it will automatically use the scheme from app.json if defined. No need to override it with Linking.makeUrl. Have you tried that?

#5

Thanks for the response @esamelson ! Hmm I do have a scheme in the app.json, but I don’t think I have tried using just AuthSession.getRedirectUrl() in production – I will test that out and report back what I find. .

#6

It still does not work for me in production, it gets to the facebook permissions modal and then once I log in via facebook it errors out… In debug mode, the error is something like “invalid redirect url”

closed #7

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