401 redirect_uri_mismatch with .net core web application? - asp.net-core

Authorization Error
Error 400: redirect_uri_mismatch
You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy.
If you're the app developer, register the redirect URI in the Google Cloud Console.

The redirect uri sit he URI where you are telling the authorization server to return authorization to. This uri must be registered in Google developer console for your project.
So redirect uri miss match means that your application is telling the authorization server to return the authorization code to a uri that you have not configured in Google developer console. The easiest solution is to take the uri its telling you is missing and simply add it.
This video will show you how to add it. Google OAuth2: How the fix redirect_uri_mismatch error.

Related

How can I introduce the URI I need

I can't get the client token code from google spreadsheet addon gravity forms. I have got the Client Id, the secret code and I have filled the domain, etc. But i dont know how to solve this issue.
Error: redirect_uri_mismatch
The redirect URI in the request, https://findoit.app/, 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/125591414320-20nvdkbr8cepaf436densffj569492bf.apps.googleusercontent.com?project=125591414320
How to set-up the redirection URI
Go to your cloud console
Choose a project
Go on APIs & Services -> Credentials
+Credentials
Create OAuth client ID
Choose Web Application
Specify Authorized redirect URIs
If required: add the URI to the authorized domains list before submitting
Create credentials

Cannot add http url to Authorized redirect URIs in gcloud's OAuth 2.0 client IDs

I have a webapp that uses google authentication. When I click on the login, it gets the following error:
The redirect URI in the request, http://campus-study-2019.appspot.com/oauth2callback, 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/477760217336-q6bdhcdqvsrf56kaa7k0ifennf775lug.apps.googleusercontent.com?project=477760217336
When I try to add
http://campus-study-2019.appspot-preview.com/oauth2callback to my Authorized redirect URIs in the Google Cloud platforms. I get the following:
Invalid Redirect: You are using a sensitive scope. URI must use https:// as the scheme.
Does anyone have any idea?
However, previously (1-2 months ago) I could easily add http in the list of authorized redirect URIs
Make sure to check the protocol "http://" or "https://" as google checks protocol as well. Better to add both URL in the list.
& or &?
trailing slash(/) or open ? (CMD/CTRL)+F, search for the exact match in the credential page. If not found then search for the missing one.
Wait until google refresh it. May happen in each half an hour if you are changing frequently or it may stay in the pool.
For your reference, please check the below link where you could check other options about your issue:
Google OAuth 2 authorization - Error: redirect_uri_mismatch
The error is due to there being at least one restricted scope added to the project where the OAuth client ID resides.
You can see the set scopes for Google APIs by going to your project in the Developers Console -> APIs & Services -> OAuth consent screen. To fix the error there are two options:
Remove the restricted scopes from the project (there will be a warning icon next to them on the OAuth consent screen page)
Add only HTTPS URLs as authorized restricted URIs (https://campus-study-2019.appspot-preview.com/oauth2callback in this case)

Getting error on login with angular 2 google and firebase

I am using firebase 3 and ng 2.
My issue I am getting error when click on connect with google account.
My error is:
Error: redirect_uri_mismatch
400. That’s an error.
Error: redirect_uri_mismatch
Application: Events Manager
You can email the developer of this application at: .....#gmail.com
The redirect URI in the request, https://......firebaseapp.com/__/auth/handler, does not match the ones authorized for the OAuth client. Visit https://console.developers.google.com/......apps.googleusercontent.com?project=181586 to update the authorized redirect URIs.
my project runs on http://localhost:3000/#/login
when I am going to console.developers.google.com Authorized redirect URIs-> http://localhost:3000/
Any idea whey is it happens?
the issue was need to add to firebase auth link the correct host.
firebase-> OAuth redirect domains

Custom local URL results in redirect_uri_mismatch

I am using a custom local URL for development of a project that authenticates with both Google and Adwords using OAuth2.
The entry in my /etc/hosts file looks like:
127.0.0.1 sub.example.dev:3001
In the Google Cloud Platform console I have an OAuth 2.0 client ID setup with:
type: Web Application
Authorized JavaScript origin: http://sub.example.dev:3001
Authorized redirect URIs:
http://sub.example.dev:3001/auth/adwords/callback
http://sub.example.dev:3001/auth/google/callback
I authenticate with with both Google and Adwords separately. Previously I was using localhost:3001 instead of the custom URL which was working for both Google and Adwords. After switching to the custom local URL the Google auth still works, but when I try to authenticate with Adwords I get a redirect_uri_mismatch error.
The error page tells me that "The redirect URI in the request, sub.example.dev:3001/auth/adwords/callback, does not match the ones authorized for the OAuth client." The URI reported here is exactly the same as what I have as an authorized redirect URI (minus the protocol).
Why does this work with Google OAuth, but not Adwords? How can I get a custom local redirect URL to work with Adwords OAuth?
Thanks!
I found the issue, and there was a hint in the question itself. The redirect URL that I pass during the OAuth flow needs to contain the protocol and I had missed that in my config.
The redirect URL I was passing in the OAuth flow was sub.example.dev:3001/auth/adwords/callback
I changed it to http://sub.example.dev:3001/auth/adwords/callback and now it works! :D

Which Google Data YouTube API Client ID to use?

I am trying to access YouTube API using ASP.net MVC 4.
Should I use :
Client ID for web application or Client ID for native application?
I tried both:
Using Client ID for web application will give me this error: The redirect URI in the request: http://localhost:55193/authorize/ did not match a registered redirect URI
Using Client ID for native application will redirect me to this page with a token: http://localhost:55318/authorize/?code=4/ufFRXOfT7GS28wg_eqA9pQ9wVtFN.cgyV3VCJtGkXdJfo-QBMszsijcV9jQI
I am confused of google limited documentation.
If you're building a WebApp, you should use the client ID for web application. The error messages you're seeing indicate that your app is configured to, after authorizing, redirect to the URLs you see there, but you haven't set, in the console, the permissions to let those URLs handle callbacks.
Visit the developer console (https://console.developers.google.com/) and find your project, then choose the "credentials" link under the APIs & Auth section. Look for the client ID that you're using, and edit it; there will be a field to put in your allowed redirect URIs (in other words, the permissible places that your oAuth calls can redirect to after visiting google's auth endpoints).