简体   繁体   English

如何在chrome自定义标签android中共享cookie数据

[英]How to share cookie data in chrome custom tabs android

We have an android app where we want to open a url.To avoid user re entering user name and password, we want to pass the session cookies. 我们有一个Android应用程序,我们想要打开一个url。为了避免用户重新输入用户名和密码,我们想传递会话cookie。 We can use webview inside our app to do this but we want to avoid webviews. 我们可以在我们的应用程序中使用webview来执行此操作,但我们希望避免使用Web视图。

Another solution we found is using chrome custom tabs. 我们发现的另一个解决方案是使用Chrome自定 As per the documentation https://developer.chrome.com/multidevice/android/customtabs chrome custom tabs supports: 根据文档https://developer.chrome.com/multidevice/android/customtabs chrome自定义选项卡支持:

Shared Cookie Jar and permissions model so users don't have to log in to sites they are already connected to, or re-grant permissions they have already granted. 共享Cookie Jar和权限模型,因此用户无需登录已连接的站点,也无需重新授予他们已授予的权限。

I am trying the example from https://github.com/GoogleChrome/custom-tabs-client But i am not able to figure out how to pass the session data. 我正在尝试https://github.com/GoogleChrome/custom-tabs-client中的示例但我无法弄清楚如何传递会话数据。

Can anyone help me by pointing to documentation or way to achieve this ? 任何人都可以通过指向文档或方法来帮助我实现这一目标吗?

The shared cookie jar means that the Custom Tab shares the cookie jar with Chrome. 共享cookie jar意味着自定义选项卡与Chrome共享cookie jar。 As of today, it is not possible to set a cookie from the application inside a Custom Tab. 截至今天,无法在“自定义”选项卡中的应用程序中设置cookie。

On the other hand, you may want to check Smart Lock for Passwords , which enables automatic sign-in across applications and websites (and will work inside a Custom Tab) 另一方面,您可能需要检查Smart Lock for Passwords ,它可以跨应用程序和网站自动登录(并且可以在自定义选项卡中使用)

This feature appears to be something the Chromium team wanted to do, but hasn't implemented yet. 这个功能似乎是Chromium团队想要做的事情,但还没有实现。 Here is the bug-report/feature-request that suggests a possible workaround. 以下是错误报告/功能请求 ,建议可能的解决方法。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM