简体   繁体   English

Chrome自定义标签有时会在登录时卡在黑屏上

[英]Chrome custom tab gets sometimes stuck at blank screen during login

We recently integrated AppAuth into our application to automate the OAuth2 authorization code flow. 我们最近将AppAuth集成到我们的应用程序中,以自动执行OAuth2授权代码流程。 When user wants to login, he is first redirected to our auth server, where he proceeds with the login, and then gets redirected back to the application. 当用户想要登录时,首先将他重定向到我们的身份验证服务器,在该服务器上继续进行登录,然后将其重定向回到应用程序。

We use chrome-custom-tabs to for opening the login page (AppAuth). 我们使用chrome-custom-tabs打开登录页面(AppAuth)。 The problem is that it sometimes gets stuck at a blank screen (chrome tab displays just blank page without the rendered site or redirect). 问题在于它有时会卡在空白屏幕上(chrome标签仅显示空白页面而没有呈现的站点或重定向)。 This happens when the user already has a session in the browser so the tab should close automatically and redirect user back to the application (authenticated). 当用户在浏览器中已有会话时,会发生这种情况,因此选项卡应自动关闭并将用户重定向回应用程序(已验证)。 It does not behave consistently and we only experience this issue sometimes (~50/50). 它的行为不一致,有时我们只会遇到此问题(〜50/50)。

I am happy to add some code but don't know where to start (trying to avoid wall of text). 我很乐意添加一些代码,但不知道从哪里开始(试图避免出现文字障碍)。 Is there a known issue or caveat? 是否存在已知问题或警告?

We tried switching contexts as described here but kept experiencing the same issue. 我们按照此处所述尝试切换上下文,但一直遇到同样的问题。

Lead maintainer of AppAuth here. AppAuth的首席维护者。 This is most likely happening because the authorization redirect is happening without any user interaction. 这很可能发生,因为授权重定向在没有任何用户交互的情况下发生。 Chrome enforces a policy that it will only send redirects to your app if the redirect was triggered by a user action, such as submitting a form that redirects or clicking on a link. Chrome会执行一项政策,即仅在用户操作(例如,提交重定向表单或单击链接)触发了重定向后,才会将重定向发送到您的应用。

If the IDP you are integrating with supports it, you can pass "prompt=consent" as a parameter to force user interaction. 如果您要与之集成的IDP支持它,则可以传递“ prompt = consent”作为参数来强制用户交互。 Alternatively, you can set up an intermediary page that captures the redirect and displays a "welcome back" message, with a link or button to return to your app. 另外,您可以设置一个中间页面,该页面捕获重定向并显示“欢迎回来”消息,并带有链接或按钮以返回到您的应用程序。

Another way is to make the user, use the login screen each time. 另一种方法是使用户每次都使用登录屏幕。

just add ".setPrompt("login")" to the authRequestBuilder. 只需将“ .setPrompt(” login“)”添加到authRequestBuilder。

so mine will be: 所以我的将是:

val authRequest = authRequestBuilder
        .setPrompt("login")
        .build()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 CollapsingToolbarLayout有时会被下方的SwipeRefreshLayout卡住 - CollapsingToolbarLayout gets stuck sometimes with SwipeRefreshLayout beneath 为什么有时动画会卡在Android上? - Why does the animation gets stuck on Android sometimes? 尝试使用 Apple Music 登录时,MusicKit 卡在加载屏幕上(用于媒体控制) - MusicKit gets stuck on the loading screen when trying to login with Apple Music (for media contols) Android webview 小部件卡在空白屏幕上 - Android webview widget stuck on blank screen Android登录屏幕为空白 - Android login screen goes blank Android-自定义按钮卡在“按下”位置 - Android - Custom Button gets stuck “Pressed” 我们可以在 android 中使用 chrome 自定义选项卡的安全标志来限制屏幕截图吗? - Can we restrict screen capture using secure flag for chrome custom tab in android? Android Chrome 检查设备黑屏 - Android Chrome Inspect Devices Blank Screen facebook connect for android返回空白登录界面? - facebook connect for android returns a blank login screen? 带有“自定义Chrome”标签的回收视图 - Recycled View with Custom Chrome Tab
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM