facebookreact-nativeexpofacebook-permissions

Permissions are not showing on facebook login screen


Some how facebook is not showing permissions required even if they are already aloud by facebook team, I'm asking for user_gender user_likes and user_birthday I have all the permissions approved but user_birthday now on the facebook login screen it doesn't show all the permissions required,

permissions missing enter image description here

here is my code

login = async () => {
    try {
      this.setState({ showSpinner: true });
      const APP_ID = 'XXXXXXXXXX';
      const options = {
        permissions: ['public_profile', 'user_birthday', 'user_likes', 'email', 'user_gender'],
      };
      await Facebook.initializeAsync(APP_ID);
      const {
        type,
        token,
        expires,
        permissions,
        declinePermissions,
      } = await Facebook.logInWithReadPermissionsAsync(APP_ID, options);
      if (type === 'success') {
        // console.log('success');
        const fields = ['id', 'first_name', 'birthday', 'likes', 'gender'];
        // console.log(`fields ${fields}`);
        const response = await fetch(`https://graph.facebook.com/me?fields=${fields.toString()}&access_token=${token}`);
        const userData = await response.json();
        // console.log(`a ver que  onda: ${userData.first_name}`);
        await this.authenticate(token, userData);
      } else {
        this.setState({ showSpinner: false });
      }
    } catch ({ message }) {
      alert(`Facebook Login Error: ${message}`);
    }
  };

It usually show all the permissions required but suddenly it stops showing them. If someone knows where should I look I'll appreciated.


Solution

  • I figure it out on the await facebook.logInWithReadPermissionsAsync(APP_ID, options) I got rid of APP_ID because it is already initialize in the line await facebook.initializeAsync(APP_ID) and end up with

    await Facebook.initializeAsync(APP_ID);
      const {
        type,
        token,
        expires,
        permissions,
        declinePermissions,
      } = await Facebook.logInWithReadPermissionsAsync(options);
    

    And it worked again fine! it shows the permissions need it. :)

    [![Permissions working][1]][1]