我有一个 expo react 本机应用程序,它使用 Expo AuthSession.startAsync 使用外部提供程序登录。突然之间,它在获得访问令牌后停止重定向回应用程序,我不知道为什么,据我所知,一年多来没有任何变化,所以我对发生的事情完全感到困惑.这是代码......基本上不会返回结果,它只是重定向到模式上查询字符串中带有#access_token的页面,但之后没有任何反应? const result = await AuthSession.startAsync({ authUrl: url }); if (result.type === "cancel") { // do nothing } else if (result.type !== "success") { Alert.alert("Error", "There was an error logging in to the external provider, please try again."); } else { const accessToken = result.params.access_token; console.log(accessToken); this.props.setAccountJwt(accessToken); navigate("Levels"); }
1 回答

互换的青春
TA贡献1797条经验 获得超6个赞
我找到了答案,与代码无关。
我网站上的重定向页面只有一个脚本标签,仅此而已。
我唯一的猜测是移动浏览器必须进行更新以不运行仅包含脚本文件的页面。
只要我把一个完整的 html 页面放在那里,我的脚本块就在那里重定向,然后它就恢复了生机。
window.location.replace('https://auth.expo.io/@@myapp' + window.location.hash);
添加回答
举报
0/150
提交
取消