Error: redirect_uri_mismatch message on Google oAuth? - google-oauth

I deployed an app to production and i'm getting an error message
Erreur 400 : redirect_uri_mismatch The redirect URI in the request, http://codesnippets.azurewebsites.net/auth/google/callback, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs.
However I added the link to the URI along with the link http://localhost:3000/auth/google/callback. I did the same with the website http://www.mywebsite.com/auth/google/callback but when i try to add it i have a message saying that the app is in production and the URL should be https?

The redirect uri in Google developer console must exactly match the redirect URI your application is calling from.
The easiest way to fix it is to copy the exact url the error message is giving you. If its https you need https if it has a prot you need a port if there is a trailing slash you must include that is as well.
In your case you should add
http://codesnippets.azurewebsites.net/auth/google/callback
This video will walk you though it. Google OAuth2: How the fix redirect_uri_mismatch error.
I was able to add it to a web client with no issues relating to it not being https.

Related

Google OAuth2 Error: redirect_uri_mismatch

My client is use other type
I have no idea why i get redirect_uri_mismatch error. It work on localhost but not on domain.
Client type other is for installed applications it should not have a redirect uri the way it works is it returns the authorization code directly back where it came from that being
localhost
127.0.0.1
urn:ietf:wg:oauth:2.0:oob
For some reason your code is sending a https redirect uri which is in correct it should not be doing this. It looks like you are using the code for a web browser application with a native application client.

Google Authorized redirect URIs format

I am trying to integrate Google authentication with my ASP.Net core application. I have successfully integrated the appliation with Google authentication, after the login google redirects back to the home page of the application. I however would like it to redirect to https://localhost:44303/Home/dashboard.
To fix this, I have changed the "Authorized redirect URIs" from https://localhost:44303/signin-google to https://localhost:44303/Home/dashboard, but when i do that I get a redirect_uri_mismatch error. Is there a particular "Authorized redirect URIs" format that i need to follow? I checked the documentation at https://developers.google.com/identity/protocols/OAuth2WebServer but perhaps I am missing something very obvious.
OAuth Consent screen: I cannot add localhost in the "authorized domains" textbox.
OAuth Client Restrictions: If I add https://localhost:44303/Home/dashboard in the authorized redirect url's then I get a redirect_uri_mismatch error.
Stack Trace:
Error: redirect_uri_mismatch
The redirect URI in the request, https://localhost:44303/signin-google, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/oauthclient/685730099587-d2rac5lt7981tjkoo5td23ogm2q1at20.apps.googleusercontent.com?project=685730099587
Learn more
Request Details
response_type=code
client_id=685730099587-d2rac5lt7981tjkoo5td23ogm2q1at20.apps.googleusercontent.com
redirect_uri=https://localhost:44303/signin-google
scope=openid profile email
state=CfDJ8HG_FpcxsWVNk9Pwwx_Fh6NNjkmrebqlP7rA3Y3u0fx42o-r6KMmiNmbmC2vjIuZLqmTZMA8O8AfMgIxXO8Tj9k3x2PLe6wNyL7xqOXi6Yj-AJUmeZFwievUqEAuCKHClYJOFPAlKTxrnYIYCXoJjvwg8BM4JBKA_NgFGjy_CbGHrI2kyUC63Z7INhYHdwEyO13AsBfYXR4LfxAGf3jz3x8-ZKDUDgFOqYYKXXcDHt2VqlERXOVXdEqNUcxUtfhM
Just run into the same problem!
Just add to the Authorized Redirect URL:
https://localhost
Without any port or additional thing!
The message
The redirect URI in the request,
https://localhost:44303/signin-google, does not match the ones
authorized for the OAuth client. To update the authorized redirect
URIs, visit:
https://console.developers.google.com/apis/credentials/oauthclient/685730099587-d2rac5lt7981tjkoo5td23ogm2q1at20.apps.googleusercontent.com?project=685730099587
tells you pretty much all you need to know. Note that you can configure multiple redirect URLs to deal with every permuatation of test, stage and production servers. Just make sure that the redirect URL your app uses is an exact string match to one of the configured URLs.

Issue in setting redirect URL in OneDrive application

I have Integrated OneDrive with my web application, on my local machine
for testing I had used http://localhost:123/Web/xyz in redirect URL on Application Registration Portal and it worked fine, but now I have deployed ny application on local server for further testing before going live and wanted to update Redirect URL to http://abc-xyz:81/Web/example and it gives error "Your URL can't contain a query string or invalid special characters."
how can I fix this issue
That error message is unfortunate. The error here is likely that redirect URLs for non-localhost servers need to be HTTPS and it looks like you are using an HTTP URL.
They have restriction about setting new redirect urls, it must be either
match the DNS name of the existing
sub domain of exiting
see https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-limitations#restrictions-on-redirect-uris for more details

hybridauth: redirect URI is not whitelisted in the app

i am configuring single sign on feature with hybridauth plugin. It took me 2 days setup this. However, i am getting redirect uri error with facebook and google.
In google and facebook i have given website name like this http://example.com
i didn't found anywhere to put redirect url.
Now when i click on facebook or google. I am getting below error.
URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings.
Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs.
Google error is below.
400. That’s an error.
Error: redirect_uri_mismatch
Login page exist on root and there is a folder i have created for hybridauth.
Inside that folder index.php file.
In config.php file. i have given baseurl like this.
"base_url" => "http://example.com/hybridauth/index.php",
I know this question doesn't have much code. But as per me issue with base_url and facebook/google oauth api.
You should be able to set Authorized redirect URIs on the provider's page. For example, on Google's Developer Console, you should be able to set the Authorized redirect URIs on the Credentials tab for your app:

redirect_uri_mismatch - What is wrong with the address I'm using?

When I try to access my Google calendar (via Roundcube webmail, using google_oauth2 plugin), I get this exact error:
Error: redirect_uri_mismatch error. The redirect URI in the request:
http://mail.domain.com:1066/?_task=settings&_action=google_redirect&_enable=cb did not match a registered redirect URI
My webmail is hosted at this address: http://mail.domain.com:1111/RCmail/
My google project settings are as follows:
Authorized JavaScript origins
http://mail.domain.com:1111
Authorized redirect URI
http://mail.domain.com:1111/RCmail/?_task=settings&_action=google_redirect&_enable=cb
https://mail.domain.com:1111/RCmail/
NOTE: directing to mail.domain.com:1111 (without the RCmail path) just redirects it to my xampp page which isn't what I want
Because the redirect_uri in the request doesn't match any one you register in Google sonsole.
check it again, they are different:
http://mail.domain.com:1066/?_task=settings&_action=google_redirect&_enable=cb
http://mail.domain.com:1111/RCmail/?_task=settings&_action=google_redirect&_enable=cb