如何获取谷歌TokenAuth工作吗? [英] How to get Google TokenAuth working?

查看:1851
本文介绍了如何获取谷歌TokenAuth工作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个YouTube上传应用程序,并有一些麻烦与认证的特定部分。的ClientLogin到目前为止,工程和上传的YouTube收到。不过,我要我的重定向用户登录到YouTube的头版。我注意到,有登录通过URL到Gmail的一种可能性:accounts.google.com/TokenAuth?auth = ....
这应该在YouTube的完全相同的方式是不可能的。在Gmail的A登录将包括我需要为YouTube上登录的cookie。

I'm developing a youtube upload application and have some troubles with a specific part of authentication. ClientLogin so far, works and uploads are received by Youtube. However I have to redirect my users logged in to the Youtube-Frontpage. I've noticed that there's a possibility to login to gmail via a url: accounts.google.com/TokenAuth?auth=.... This should be possible in the exact same way for youtube. A login at "gmail" will include the cookies I'd need for youtube login.

不过,我没有得到它的工作。我有哪个身份验证令牌使用?我试了很多,在响应的ClientLogin提供的之一。我问www.google.com/accounts/IssueAuthToken URL(这给了我一个记号回来,但我不能用它登录)。
比如我已经试过:

However, I'm not getting it to work. Which auth token do I have to use? I tried many, the one provided in the clientlogin response. I queried www.google.com/accounts/IssueAuthToken url (which gives me a token back, but I cannot login with it). For example what I've tried:

<一个href=\"https://accounts.google.com/TokenAuth?auth=token-received-by-issueAuthToken&service=youtube&continue=http://youtube.com&source=googletalk\" rel=\"nofollow\">https://accounts.google.com/TokenAuth?auth=token-received-by-issueAuthToken&service=youtube&continue=http://youtube.com&source=googletalk

<一个href=\"https://accounts.google.com/TokenAuth?auth=token-received-by-issueAuthToken&service=mail&continue=http://mail.google.com/mail&source=googletalk\" rel=\"nofollow\">https://accounts.google.com/TokenAuth?auth=token-received-by-issueAuthToken&service=mail&continue=http://mail.google.com/mail&source=googletalk

这些都不似乎工作。该ClientLogin验证与服务= YouTube的做 - 是错误

None of these seem to work. The Clientlogin authentication was done with "service=youtube" - is that the mistake?

我想AP preciate可以clarifiy我的问题的任何信息。

I'd appreciate any information that can clarifiy my problem.

问候,
丹尼斯·菲舍尔

Regards, Dennis Fischer

推荐答案

所以 - 嗯 - 我得到了这个工作最后。我花了一些时间,因为没有真正的文档。
我将解释请求是如何工作的,你需要做3请求:

So - well - I got this working finally. It took me some time because there is no real documentation. I'll explain how the requests work, you'll need to do 3 requests:

1:你在google.com/accounts/ClientLogin默认的ClientLogin
提供电子邮件=的emailadress&安培; =的passwd密码和放大器;服务=盖亚数据,以及您要添加到ClientLogin的其他任何参数。
您会收到3令牌,SID,LSID和验证 - !你需要SID和LSID仅

1st: Do a default clientLogin at google.com/accounts/ClientLogin Provide Email=emailadress&Passwd=Password&service=gaia as data, as well as any other parameter you want to add to clientLogin. You'll receive 3 Tokens, SID, LSID and Auth - you'll need SID and LSID only!

第二:你到google.com/accounts/IssueAuthToken请求
添加paramters SID =SID提取与&amp; LSID =LSID提取与&amp;服务=盖亚的URL。
您会收到的authToken这应该与这些字符开头的:APH -....
如果不是这种情况下,你这个请求失败,原因是错误的参数(最有可能的失踪的服务=盖亚)。
将需要在你的第三个请求,该令牌。

2nd: Do a request to google.com/accounts/IssueAuthToken Add paramters SID="Extracted SID"&LSID="Extracted LSID"&service=gaia to the URL. You'll receive an AuthToken which should start with these characters: "APh-...." If this is not the case your this request failed due to wrong parameters (most likely missing "service=gaia"). This token will be needed in your 3rd request.

第三步:做对google.com/accounts/TokenAuth?auth=\"token请求在步骤2中获得&放大器;服务=您想要的服务进行身份验证,如邮件&放大器;源=例如GoogleTalk测试 &安培;继续=你在哪里重定向的URL,这是 http://mail.google.com/mail 以服务信箱

3rd: Do a request to google.com/accounts/TokenAuth?auth="token received in step 2"&service="service where you want to authenticate, e.g. mail"&source="for example googletalk"&continue="the url where you're redirected to, this is http://mail.google.com/mail for service mail"

这第三个要求是在浏览器中最有可能完成的。
恭喜你,你在用户进入他的谷歌帐户的两步验证登录。你并不需要真正的密码,应用程序特定密码就足以产生这些令牌。

This 3rd request is most likely done in a browser. Congratulations, you logged in a user into his google account with 2-Step Auth. You don't need the "real password", the application specific password is enough to generate these tokens.

问候,
丹尼斯·菲舍尔

Regards, Dennis Fischer

这篇关于如何获取谷歌TokenAuth工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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