2012-05-24 64 views
1

我试图按照https://developers.google.com/accounts/docs/OAuth2UserAgent的指示进行操作,以便使用Google Drive应用程序登录。基于OAuth的认证API的信息,我拥有的是:Google Drive的OAuth2客户端应用程序登录

Client ID for web applications 
Client ID:   444837786259.apps.googleusercontent.com 
Email address:  [email protected] 
Client secret:  [snip] 
Redirect URIs:  http://meridiandigital.co.uk/drivecrypt/ 
        http://apate.meridiandigital.net/drivecrypt/ 
JavaScript origins: http://meridiandigital.co.uk 
        http://apate.meridiandigital.net 

Client ID for Drive SDK 
Client ID:   444837786259-8vsffg8dnl2s8hvoeiu8v0laqaqc5p2p.apps.googleusercontent.com 
Client secret:  [snip] 

在我的客户,我发现,我没有一个有效的令牌和用户发送到以下网址的情况下

https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/drive.file+https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile&response_type=token&redirect_uri=http://apate.meridiandigital.net/drivecrypt/&client_id=444837786259-8vsffg8dnl2s8hvoeiu8v0laqaqc5p2p.apps.googleusercontent.com 

我得到的以下错误消息来自Google:

The redirect URI in the request: http://apate.meridiandigital.net/drivecrypt/ did not match a registered redirect URI 

from_login=1 
scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/drive.file 
response_type=token 
access_type=online 
redirect_uri=http://apate.meridiandigital.net/drivecrypt/ 
approval_prompt=auto 
as=488fe0f410123e7c 
pli=1 
client_id=444837786259-8vsffg8dnl2s8hvoeiu8v0laqaqc5p2p.apps.googleusercontent.com 
authuser=0 
hl=en-GB 

任何想法我做错了什么?

回答

1

您需要使用由API控制台生成的Web应用程序的客户端ID(并且您的Drive SDK应用程序也使用相同的ID)。

由于没有为客户端ID 444837786259-8vsffg8dnl2s8hvoeiu8v0laqaqc5p2p.apps.googleusercontent.com注册重定向URI,因此引发错误。如果您尝试使用444837786259.apps.googleusercontent.com,它应该可以工作。

相关问题