1

我正在尝试按照https://developers.google.com/accounts/docs/OAuth2UserAgent上的说明使用 Google Drive 应用程序登录。我拥有的 OAuth API 信息是:

Client ID for web applications
Client ID:          444837786259.apps.googleusercontent.com
Email address:      444837786259@developer.gserviceaccount.com
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]

在我的客户端中,我检测到我没有有效令牌并将用户发送到以下 URL 的情况

 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

任何想法我做错了什么?

4

1 回答 1

1

您需要将客户端 ID 用于 API 控制台生成的 Web 应用程序(也将其用于您的 Drive SDK 应用程序)。

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

于 2012-05-24T17:32:01.000 回答