如何在Chrome自定义标签中分享Cookie数据Android [英] How to share cookie data in chrome custom tabs android

查看:425
本文介绍了如何在Chrome自定义标签中分享Cookie数据Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Android应用程序,我们要打开一个url。为了避免用户重新输入用户名和密码,我们要通过会话cookie。我们可以使用webview在我们的应用程序中这样做,但我们想避免网络视图。

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. We can use webview inside our app to do this but we want to avoid webviews.

我们发现的另一个解决方案是使用Chrome自定义标签。根据文档 https://developer.chrome.com/multidevice/android/customtabs Chrome自定义标签支持:

Another solution we found is using chrome custom tabs. As per the documentation https://developer.chrome.com/multidevice/android/customtabs chrome custom tabs supports:


共享Cookie Jar和权限模型,因此用户不必登录到他们已经连接的网站,或重新授予权限

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.

我正在尝试 https://github.com/GoogleChrome/custom-tabs-client 但是我不能弄清楚如何传递会话数据。

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.

任何人都可以通过指向文档或方式来实现这一点来帮助我?

Can anyone help me by pointing to documentation or way to achieve this ?

推荐答案

共享cookie jar意味着自定义标签与Chrome共享cookie jar。

The shared cookie jar means that the Custom Tab shares the cookie jar with Chrome. As of today, it is not possible to set a cookie from the application inside a Custom Tab.

另一方面,您可能需要检查 Smart Lock for Passwords ,可启用跨应用程式的自动登入功能,以及网站(并将在自定义标签内工作)

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)

这篇关于如何在Chrome自定义标签中分享Cookie数据Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆