用于FB登录的Expo AuthSession不会重定向到某些Android版本的expo App

时间:2017-12-05 02:17:05

标签: android facebook authentication react-native expo

我遇到来自Expo和Facebook登录的authSession问题。 Facebook登录适用于iOS和我的Android手机。但是,某些Android手机似乎存在重定向问题。 这是手机中的FB登录流程,它不会完全重定向到应用程序 enter image description here enter image description here enter image description here

这是我的App.json:

{
  "expo": {
    "name": "Scapegoat",
    "icon": "./app/images/logo.png",
    "version": "1.0.1",
    "sdkVersion": "23.0.0",
    "facebookAppId": "1XXXXXXXXXXX",
    "facebookScheme": "fb1XXXXXXXX",
    "scheme": "exp",
    "ios": {
      "bundleIdentifier": "com.scapegoatllc.scapegoatmobile"
    },
    "android": {
      "package": "com.scapegoatllc.scapegoatmobile",
      "permissions": [
        "android.permission.ACCESS_NETWORK_STATE",
      ]
    }
  }
}

这是我的facebook按钮按下功能,我使用AuthSession,

onFacebookButtonPress = async () => {
//const FACEBOOK_APP_ID = 'XXXXXXXXXXXX'; // -> develop
const FACEBOOK_APP_ID = 'XXXXXXXXXXXXX'; // -> staging

const redirectUrl = AuthSession.getRedirectUrl();
//exp://exp.host/@newtonsarr/scapegoat

const { type, params } = await AuthSession.startAsync({
  authUrl:
    `https://www.facebook.com/v2.5/dialog/oauth?response_type=token` +
    `&client_id=${FACEBOOK_APP_ID}` +
    `&redirect_uri=${encodeURIComponent(redirectUrl)}`,
});

if (type === 'success') {
  this.props.onLoginWithFacebook({ access_token: params.access_token });
}
};

我目前的设置有什么问题吗?如何确保Facebook登录始终重定向回应用程序?非常感谢提前。

1 个答案:

答案 0 :(得分:0)

重定向网址错误尝试首先记录, 它的格式为https://auth.expo.io/@username/appname

相关问题