The redirect URI provided in the request: http://test.mywebsite.com/myapp/ 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://test.mywebsite.com/myapp/
approval_prompt=auto
client_id=987654321098-zyxwvutsrqponmlkjihgfedcba.apps.googleusercontent.com
What could I be doing wrong? The redirect URI seems to be accurate based on my setup.
yeah this happend to me too… you got two oauth clients but theyre not synced up. the redirect uris you listed are only registered for the first client id (987654321098.apps.googleusercontent.com) but your using the second one in the auth url. just go back to google console and add those redirect uris to your drive sdk client or switch to using the web app client id instead
Looking at your configuration, the issue appears to be that you have two different OAuth2 clients set up but you’re mixing their credentials. You’re using the client ID from your Drive SDK credentials (987654321098-zyxwvutsrqponmlkjihgfedcba.apps.googleusercontent.com) in the authorization URL, but the redirect URIs are configured under your Web App Credentials (987654321098.apps.googleusercontent.com). Each OAuth2 client has its own set of allowed redirect URIs that must be configured separately. You need to either add the redirect URI to the Drive SDK client configuration in the Google Cloud Console, or use the Web App client ID in your authorization URL instead. I encountered this exact problem last year when I had multiple OAuth clients for the same project and was accidentally cross-referencing their settings.
The root cause is definitely the client ID mismatch that others mentioned, but there’s another detail worth checking. When you configure redirect URIs in the Google Console, trailing slashes matter significantly. Your authorization request uses http://test.mywebsite.com/myapp/ with a trailing slash, so verify that your Drive SDK client configuration includes the URI exactly this way. I’ve seen cases where developers register http://example.com/callback but their application requests http://example.com/callback/ and Google treats these as completely different URIs. Also double-check that you’re editing the correct OAuth client in the console - it’s easy to modify the wrong one when you have multiple clients in the same project. After making changes, it can take a few minutes for the updated configuration to propagate across Google’s servers.