Stop asking for Facebook permissions at every login

#1

Hi!
I’m having some issue with Expo.Facebook. Is there a way to get the accessToken without requesting permission to the logged facebook user?
When it’s the first time a facebook user try to login in the app, I understand that you must ask for permissions. However, if I logout of the app, I shouldn’t have to ask for permission to the user (because he already gave it to me).
Tinder has exactly this behavior. He checks if he already have the permissions, get the accessToken and then fetch the data

1 Like
#2

@nikki do you know how to do this?

#3

By using native, it seems to work by itselft. Except the iOS version seems to open a webview and by given access to the app, it crash by saying : Cannot Open Page. Safari cannot open the page because the address is invalid.

Help?

#4

I think if you save the token to AsyncStorage you should be able to use it again after the app restarts?

#5

I’ve persisted it with AsyncStorage - the trick is to refresh Facebook’s access token before their expiration date. AFAICT, you’ll need to do a server-side call or have the user go through the login flow again to refresh the token.

More details here: Full Facebook SDK

Using Facebook w/ Expo is great to get started with and then managing a production workflow becomes a bit more involved.

1 Like
#6

But if i want to use the native behavior, I get the cannot Open Page. Safari cannot open the page because the address is invalid.
Url of the page of which the alert appears: https://m.facebook.com/v2.9/dialog/oauth/confirm
Note, the facebookScheme is correctly set in the app.json because some iPhone do work properly (their login behavior is different but it works)

1 Like