Receiving a "redirect_uri_mismatch" error when authorizing with OAUTH 2.0 only on mobile - oauth-2.0

here's a screenshot of the error
https://i.stack.imgur.com/m1DAp.jpg
here's a screenshot of OAuth client redirect uris and js origins
https://i.stack.imgur.com/5eBvs.png
on desktop everything works fine, problem is when i try to test it on a phone it shows me this error
request details says that i need to add https://main--rainbow-marzipan-5180d2.netlify.app/ to redirect uri , but its already there
ps: first post here be nice :D

Related

Getting login and redirect issues from Google

Trying to set up an Authentication for my app, and all seemed to be working correctly, but when I tried testing it out I got this error message
Authorization Error
Error 400: redirect_uri_mismatch
The redirect URI in the request, http://localhost:3000/api/auth/callback/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/${your_client_id}?project=${your_project_number}
Can you point me in the right direction to fixing this?
Error 400: redirect_uri_mismatch
Is a configuration issue. The redirect uri is used to return the authorization code to your application after the user has consented to your applications access to your data. You have created a web client credentials up on Google developer console.
What you need to do is go back there and add a Redirect uri of
http://localhost:3000/api/auth/callback/google
It must match exactly don't add any spaces at the end or anything.
If you have any issues i have a video which will show you exactly how to add it Google OAuth2: How the fix redirect_uri_mismatch error. Part 2 server sided web applications.
Seems like there's a mismatch with the Authorized redirect URIs. Are you sure you have entered the correct URIs? Redirect URI should be the URL that you'll be redirecting the user to after the login page or the base URL of your application Eg: https://localhost:8000
Also, make sure that you are using the correct Client ID and Client secret
Similar Questions
Google OAuth 2 authorization - Error: redirect_uri_mismatch
Correct redirect URI for Google API and OAuth 2.0

How can I edit existing Authorized redirect uri in google console?

I created an oAuth key for my laravel site for google login. I successfully implemented this in local. But when I migrated my site to live I got this error:
400. That’s an error.
Error: redirect_uri_mismatch
Request Details
client_id=xxxxxxx-0fic8dnvcgo672unju9ai619iXXXXXX.apps.googleusercontent.com
redirect_uri=https://laravel.themenepal.com/gharsansar/auth/google/callback
scope=openid profile email
response_type=code
state=NRu0eU9UdwEXYSV0dixOc0BjuH3bluFkHiBDJFgO
That’s all we know.
I think this is primarily due to redirect url being mismatched with what is set in Google console. I've changed the redirect urls in .env. I have searchd a lot to be able to update the redirect uri in google console but nothing helped.
If you know that would be a great help.
UPDATE: The screenshot of the url edit page is as follows:
If you goto: https://console.developers.google.com/apis/credentials and select the correct project, then the correct the correct OAuth 2.0 client IDs and edit the correct OAuth 2.0 client IDs.
There appears to be no option to edit it if it's created as an OAuth 2.0 client ID of type "Other." If you choose Web Application, you can edit them yourself.

ADFS 3.0 oAuth oauth2/token -> no registered protocol

I'm trying to use the oAuth functionality of adfs but are struggling to get an access token out of it.
The setup is a Windows Server 2012 R2 Preview Edition installed in a virtualbox vm.
I am able to get an access_code by issuing the following:
https://asdf.bla.dev/adfs/oauth2/authorize?response_type=code&client_id=abcd-abcd-abcd&redirect_uri=https://localhost/auth&resource=testservice.asdf.oauth
this redirects me to the following url
https://localhost/auth?code=U2dIhBsRt0eDnEhAEq2fcw.d3LeME__0QgBAC8zvLR6mTlRvC0.fLKd5eQRjXslTEeEck17m6Zo4fKKO9oGk2byUyr4CyLQHKSJs5wKzWZcusLXqXk22tdzvswxBjzaYcCqzkbeT5VxhMEdq97vbSnGAQ1tVD0vutVIfbx1Mb5A-QItgOx8a8LBapn7axCpGThoVH2jWCVM59X5eOt9ACuJTTK1UFbNaldaTkuGdqrtcGC8tFoSOP96G-4sHgIBpi2t8BSwCdf3asDd3AJAOYk6gnUkH5WJQRf2pg4S_AkgOxseeZW8Y5qbWAajyESkEmJ-UcWkV98uHlrmNsFwTSJ-ZoNk-aZI_U85ZlZrsdpKzocrWM5HmfcvXm5XdXz2QXIHngIBTA
but when I try to redeem the token with this request:
https://asdf.bla.dev/adfs/oauth2/token?grant_type=authorization_code&client_id=abcd-abcd-abcd&redirect_uri=https://localhost/auth&code=U2dIhBsRt0eDnEhAEq2fcw.d3LeME__0QgBAC8zvLR6mTlRvC0.fLKd5eQRjXslTEeEck17m6Zo4fKKO9oGk2byUyr4CyLQHKSJs5wKzWZcusLXqXk22tdzvswxBjzaYcCqzkbeT5VxhMEdq97vbSnGAQ1tVD0vutVIfbx1Mb5A-QItgOx8a8LBapn7axCpGThoVH2jWCVM59X5eOt9ACuJTTK1UFbNaldaTkuGdqrtcGC8tFoSOP96G-4sHgIBpi2t8BSwCdf3asDd3AJAOYk6gnUkH5WJQRf2pg4S_AkgOxseeZW8Y5qbWAajyESkEmJ-UcWkV98uHlrmNsFwTSJ-ZoNk-aZI_U85ZlZrsdpKzocrWM5HmfcvXm5XdXz2QXIHngIBTA
there is an error and I don't get an access-token.
The event viewer of the adfs service states the following error:
There are no registered protocol handlers on path /adfs/oauth2/token to process the incoming request....
I built the request following this information: https://github.com/nordvall/TokenClient/wiki/OAuth-2-Authorization-Code-grant-in-ADFS
I have no idea what's going wrong and would really appreciate your help!
I know that the thread is quite old but I was going through hell today when trying to resolve this error. I checked http.sys, reinstalled the server role,... nothing worked.
At the end, I had to find out that this crazy ADFS does (again) return garbage error messages. After 5 hours of debugging I didn't trust postman any longer (even if it worked without issues for months now) and used a short PowerShell script to invoke the POST with the access code:
$client = new-object net.webclient
$form = New-Object System.Collections.Specialized.NameValueCollection
$form.Add("client_id", "you client id")
$form.Add("grant_type", "authorization_code")
$form.Add("code", "authorization code")
$form.Add("redirect_uri", "your redirect uri")
$result = $client.UploadValues("https://sso.mydomain.com/adfs/oauth2/token", "POST", $form)
$decodedToken = $client.Encoding.GetString($result);
Et voila... all working. So I went back to the broken postman query, stripped all url parameters, removed all headers and added the parameters to the x-www-form-urlencoded tab. Then it worked there again.
Meaningful errors would definitely be helpful. Hope this saves someone many hours of frustrating try&error...
You are on the right track. You get code on redirect URI. Now we will have to make a POST request to the /token endpoint using the following parameters:
code - you will have to extract this value from the URL using some programming logic
client_id
redirect_uri
grant_type - use the value "authorization_code"
In response you should get a JWT access token.
It looks like you use HTTP GET to access the token endpoint, but it should be HTTP POST.

Google OAuth 2.0 redirect_uri_mismatch error

I created a Google OAuth 2.0 ClientID and secret in Google Developer console
After that I tested in Google OAuth playground (https://developers.google.com/oauthplayground).
and registered ClientID and secret already created above and applied to Google OAuth 2.0 playground setting menu.
Some people say that after creating ClientID/secret they need some time for testing. So after two days I tried to test in the same conditions but the error is same redirect_uri_mismatch.
How can I solve this?
As little as having a '/' at the end of your uri and not having the same '/' at the end in your code will throw it off.
Your site URL and the Authorized redirect URIs in developer console should be the exact match.
This kind of error occurs if one URL has www (http://www.example.com) and the other URL is non-www (http://example.com).
Other common URI mismatch are:
Using http:// in Authorized Redirect URIs and https:// as actual URL, or vice-versa
Using trailing slash (http://example.com/) in Authorized Redirect URIs and not using trailing slash (http://example.com) as actual URL, or vice-versa
Here is the step-by-step procedure (with screenshots) to update the Authorized redirect URIs in Google Developer Console (For those like me who found it difficult to get to that page).
Go to https://console.developers.google.com
Select your Project
Click on the menu icon
Click on API Manager menu
Click on Credentials menu. And under OAuth 2.0 Client IDs, you will find your client name. In my case, it is Web Client 1. Click on it and a popup will appear where you can edit Authorized Javascript Origin and Authorized redirect URIs.
Here is a Google article on creating project and client ID.
It should be a exact match what you have given in the console.developers.com.
In my case I missed the www in the url.
For eg: you have given http://www.google.com but in console.developers.com you gave http://google.com
It will still throw error. So it should be exact match.
The redirect URI (where the OAuth response is returned to) has to be registered in Google APIs console, and the error is indicating that you haven't done that, or haven't done it correctly.
Go to the console for your project and look under API Access. You should see your client ID & secret there, along with a list of redirect URIs. If the URI you want isn't listed, click edit settings and add the URI to the list.
I kept getting this same error until I realized that I needed to put "signin-google" at the end of the redirect setting in the Google API console, like this (ie, NOT http://www.example.org/api):
http://www.example.org/api/signin-google
(Magento 1.*) if You use inchoo Social Connect Magento extension then:
Set below url in your google app (OAuth 2.0 client IDs):
Authorized Redirect URIs: http://www.example.com/socialconnect/google/connect/
Authorized JavaScript Origins: http://www.example.com
Don’t forget to replace http://www.example.com with your domain
Please make sure that in your google-client-api, the value of credentials in these field are matched as what you got from Google API console:
$client->setClientId('xxx.apps.googleusercontent.com');
$client->setClientSecret('xxx');
$client->setRedirectUri('http://example.com/oauth2callback');
$client->setDeveloperKey('xx');
This could happen when the value of setRedirectUri is different from the one you set in Google API console.

Twitter Integration in Blackberry: Login Page not in English

I am trying to integrate twitter using Twitter Api me 1.8 . When i try to authorize using OAuth the login Screen look like below .Some invalid charecters are showing.please help me to identify the problem
thanks
Try with BIS. It works fine with BIS. Else you can call HTTP GET and POST methode to the following urls.
For request token call https://api.twitter.com/oauth/request_token (HTTP GET with key , secret, and signature).Then you will get the request token
For Authorization call this link in your browser https://twitter.com/oauth/authorize?oauth_token=your request token
For access token call https://twitter.com/oauth/access_token (HTTP POST with key , secret, signature , token) . Then you will get the access token and secret.
If the login page content is not displayed properly in BlackBerry, then follow this link.
Please, use BrowserFieldOAuthDialogWrapper in place of BrowserContentManagerOAuthDialogWrapper class. It works fine for me.
http://kenai.com/projects/twitterapime/forums/forum/topics/523812-A-test-for-invalid-characters-on-Blackberry#p571144
I got this success by the help of #ernandesmjr Ernandes Mourao Jr
If any find any issue. please let me know.

Resources