2012-05-24 87 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,它應該可以工作。

相關問題