使用Google登录Android SDK连接到Youtube帐户 [英] Connect to Youtube account using Google Sign-In Android SDK

查看:136
本文介绍了使用Google登录Android SDK连接到Youtube帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于Google在此博客中宣布的内容发布,我们正在将旧的基于Webview的连接流迁移到Google登录SDK.我们需要允许我们的用户将其youtube帐户连接到我们的应用程序,因此,我们开始了一个基于Web的身份验证流程,添加了Youtube范围,并且该流程还自动管理了频道选择,以防用户拥有多个频道

尽管在iOS上,Google Sign-In SDK仍在Android上使用基于网络的身份验证流程(它与频道选择非常相似),整个过程是本地的,由Play Services进行管理.不幸的是,它似乎不支持频道选择,并且会自动回退到默认频道.

我们还尝试了迁移到Chrome的自定义"标签,但是您似乎无法拦截"正在加载的网址,因此我们无法检测到该过程完成并提取了身份验证代码.

有人遇到过同样的问题吗?有什么想法吗?

谢谢!

解决方案

Play服务库不支持频道选择.

Chrome自定义标签绝对可以按您需要的方式工作(然后,它将完全像iOS上的一样).尝试使用适用于Android的AppAuth 库(由Google创建的开源库).

您将对重定向URI使用自定义URI方案,就像在iOS上一样.

交互式代码实验室很有帮助,您可以应用转到您自己的应用.

based on what Google announced in this blog post we're in the process of migrating our old webview-based connection flow to the Google Sign-In SDK. Our need is to allow our users to connect their youtube account to our app, so we were starting a web-based authentication flow with adding the Youtube scopes, and the flow also managed automatically the channel selection, in case the user have more than one.

While on iOS the Google Sign-In SDK still use a web-based authentication flow (and it works like a charm with the channel selection) on Android the whole process is native and managed by Play Services. Unfortunately it looks like it doesn't support the channel selection and it automatically fallback to the default channel.

We also tried to migrate to Chrome Custom tabs, but it looks like you're not be able to "intercept" which url is loading, and so we can't detect while the process completes and extract the authentication code.

Anyone had the same issue? Any ideas?

Thanks!

解决方案

The Play Services library doesn't support channel selection.

Chrome Custom Tabs can definitely work the way you need (and then it will be exactly like on iOS). Try the AppAuth for Android library (an open source library that was was created by Google).

You will use a custom URI scheme for the redirect URI, much like on iOS.

The interactive codelab is very helpful, you can apply the steps to your own apps.

这篇关于使用Google登录Android SDK连接到Youtube帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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