Publish Permission FBSDK

Hello! I need to logIn with facebook with publish_permissions, but we don’t have this function on Expo.Facebook yet.
So, in order to make this work, i need to detach my app and set all the android native code configs with the fbsdk ?
Is there any workaround?

Hi! I’d recommend taking a look at the AuthSession API for obtaining write permissions to FB accounts. See https://docs.expo.io/versions/latest/sdk/auth-session.html#security-considerations for information about how to keep these write operations secure.

It didn’t help anyway…

hey, can you expand on what you mean? you can use the code presented in the AuthSession code snippet to make a request to facebook and add publish permissions in the scope parameter of the request.

I’will try to do it again, maybe i missed something
Thank you samee and dikaiosune!

It didn’t work. All i need is to be capable to share some text and URL to facebook.
With the React-native Share i’m able to share only URL, without Text. Facebook SDK doesn’t work if it’s not detached from expo.
Don’t know what to do

Solved this, i’ll use the React-native Share, to share a link and i put some open graph metatags on it. It worked well for me.

I would also recommend looking into Linking with a url scheme:

dikaiosune
I tried the AuthSession to get the fb token with publish_actions permission, it worked great, but, when i click on the button and the app opens the WebBrowser, it shows me an auth.expo.io page asking if i want to continue. If i click Yes, it works.
The problem is that this page is in english, so some users will not understando what to do. It is possible to Hide/customize this page before facebook login page?

1 Like

Hey @lucasfls, i try the same thing you describe and everything seems work fine. But after login success, my app restart suddenly. Do you know this problem

put a try catch on the method you are calling the link, may be you can log what’s happening. The redirect url is ok ?

I think everything are okay, after login success on webbrowser, it redirect back to app, but when go back to app by redirect url (exp://…) it always start app from beginning, not the state when we click login facebook. And i can not get the access_token when login success. You can chat to me through skype: huylv_57

can’t chat on skype now, im working, but, try to put a try catch to deal with the error
can you post the code where you are calling the webbrowser?

async loginnn(){
    try{
      let redirectUrl = AuthSession.getRedirectUrl();
      let result = await AuthSession.startAsync({
        authUrl:
          `https://www.facebook.com/v2.11/dialog/oauth?response_type=token` +
          `&client_id=${FB_APP_ID}` +
          `&redirect_uri=${encodeURIComponent(redirectUrl)}`,
      });
      console.log('loginnn ', result );
    }catch(err){
      console.log(err)
    }
}

Here, nothing logged on console!

strange, it seems to be the same of mine.
And it’s not logging. This is mine:

let redirectUrl = AuthSession.getRedirectUrl();
console.log({ redirectUrl });
console.log(“redirect uri”,redirectUrl);
this.setState({urire:redirectUrl});
let result = await AuthSession.startAsync({
authUrl:
https://www.facebook.com/v2.11/dialog/oauth?scope=publish_actions +
&client_id=${fb_id}&response_type=granted_scopes,token +
&redirect_uri=${encodeURIComponent(redirectUrl)},
});

you have all the settings ok on fb dev. app ?