SDK版本:43.0.0
平台(Android/iOS/网络/所有):Android
您好,我在托管工作流程中使用 expo-auth-session 通过其官方 API 收集 Instagram 用户数据,它在开发环境中运行良好(通过“expo run:android”命令),但是一旦构建 APK当用户进行授权过程并且重定向开始时创建,有一个弹出窗口询问“打开方式”和我的应用程序的两个选项,第一个运行完美,第二个返回到应用程序但什么也不做,我没有测试在 iOS 上。
这是代表它的图像:点击这里查看
当我开发时,我尝试执行谷歌登录过程,但陷入了同样的错误,通过实现谷歌本机登录部分解决了。我在app.json中验证了我的方案,但没有发现错误,如下:
应用程序.json:
{
"expo": {
"name": "Secreet",
"slug": "secreet",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"scheme": "com.davidtmiranda.secreet",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true,
"usesAppleSignIn": true,
"bundleIdentifier": "com.davidtmiranda.secreet",
"googleServicesFile": "./GoogleService-Info.plist",
"config": {
"googleSignIn": {
"reservedClientId": "com.googleusercontent.apps.--------------------"
}
}
},
"android": {
"versionCode": 1,
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
},
"package": "com.davidtmiranda.secreet",
"googleServicesFile": "./google-services.json"
},
"web": {
"favicon": "./assets/favicon.png"
}
}
}
另外,我的 authSession 代码如下所示:
webBrowser.maybeCompleteAuthSession();
const useProxy = Platform.select({ web: false, default: true });
const client_id = ---;
const redirect_uri = "https://auth.expo.io/@davidtmiranda/secreet";
const scope = "user_profile";
const site =
"https://api.instagram.com/oauth/authorize?client_id=" +
client_id +
"&redirect_uri=" +
redirect_uri +
"&scope=" +
scope +
"&response_type=code&state=1";
const discovery = { authorizationEndpoint: site };
const [request, response, promptAsync] = useAuthRequest(
{
redirectUri: makeRedirectUri({
useProxy,
native: redirect_uri,
}),
scopes: [scope],
clientId: String(client_id),
},
discovery
);
useEffect(() => {
if (response?.type === "success") {
...
}
}, [response]);
function GetInstagramID() {
return promptAsync({
useProxy,
});
}
关于如何解决这个问题有什么建议吗?我相信它与模式相关,但无法确定出了什么问题。