【问题标题】:Expo AuthSession new window not redirecting on WebExpo AuthSession 新窗口未在 Web 上重定向
【发布时间】:2021-10-24 05:09:44
【问题描述】:

我们正在使用 AuthSession.startAsync 在我们的应用程序中启动身份验证过程,该过程在 iOS 和 Android 上运行良好。然而,当我们在网络浏览器上运行它时,我们的登录过程并没有重定向到正确的 Auth0 登录页面,而是打开了应用程序的另一个窗口。

导致问题的代码:

    const result = await AuthSession.startAsync({
      authUrl,
      returnUrl: Platform.OS === 'web' ? getRedirectUri() : undefined,
    });

现在 authUrl 是我们需要访问 auth0 的正确 url,但是它不会像在移动设备上那样打开这个 url 以进行登录。之前有人在 Expo 网络应用程序上遇到过这个 AuthSession 问题吗?

提前致谢!

【问题讨论】:

  • 您的getRedirectUri() 函数是否将useProxy 属性设置为true?尝试将其设置为false。

标签: react-native authentication web expo auth0


【解决方案1】:

您需要致电WebBrowser.maybeCompleteAuthSession();。

AuthSession Expo Docs 中有关于此案例的警告:

? In order to close the popup window on web, you 
need to invoke WebBrowser.maybeCompleteAuthSession().
See the Identity example for more info.

他们谈论的例子可以在这里找到:

https://docs.expo.dev/guides/authentication/#identityserver-4

【讨论】:

    猜你喜欢
    • 2022-06-19
    • 2020-06-05
    • 2022-12-11
    • 2018-05-18
    • 1970-01-01
    • 2019-12-28
    • 2011-06-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多