I’m trying to follow the instructions at https://developers.google.com/accounts/docs/OAuth2UserAgent in order to log in with a google drive application. The OAuth API info I have is:
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]
In my client, I detect the case where I don’t have a valid token and send the user to the following 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
I get the following error message from 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
Any ideas what I’m doing wrong?
You need to use the client ID for webapplication that has been generated by the APIs Console (and use the same for your Drive SDK application too).
The error is raised because no redirect URIs have been registered for the client ID
444837786259-8vsffg8dnl2s8hvoeiu8v0laqaqc5p2p.apps.googleusercontent.com. If you try with444837786259.apps.googleusercontent.com, it should work.