I am trying to connect to google drive and for that I am using python pydrive library. I have followed the documentation and written a snippet for connecting with google drive. But I get an error
Error: redirect_uri_mismatch
The redirect URI in the request, http://localhost:8080/, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs
Here is the code of pydrive that I have executed (I have installed the pydrive library as well)
from pydrive.auth import GoogleAuth
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
I am posting an image of my console.developer account, you can see I have written the address correctly as specified by the pydrive documentation. I have also added outcallback in the url but I am still getting the same error. Any help will be appreciated. Thanks
This is my client_secrets.json file content:
{"web":{,"project_id":"my-project-1532814702018","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","redirect_uris":["http://localhost:8080/oauth2callback"],"javascript_origins":["http://localhost","http://localhost:8080"]}}
(I have removed client id and client secret here)
I know its a bit late now, but it may help someone who encounters this issue.
For me it was really silly. In "Authorized redirect URIs" field it must be "http://localhost:8080/" with a slash at end. In "Authorized JavaScript origins" it must be "http://localhost:8080" without a slash.
Edit Your URL and replace http://localhost:8080/ by http://localhost:8080
it works for me
You're almost there. Just add '/oauth2callback' as indicated in the greyed texts.
So, under 'Authorized redirect URIs' :
http://localhost:8080/oauth2callback
It seems that google api has changed their policies on authorized domains, i heard there's remote domain that redirect to localhost? or you can change your hosts file... it doesnt make sense, because google supports api usage on native apps, why would they need a domain name?
Related
I am implementing OAuth 2.0 with Google API's, but the redirect Uri from Google is missing the hash (#) and path. Which causes my parsing to fail. I am building for Web Browsers.
My Request URI to Google:
https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=http%3A%2F%2Flocalhost%3A4002%2Fsso-callback&response_type=token&state=C2ubRxTMwv&client_id=...
The redirect_uri decodes to http://localhost:4002/sso-callback
Google's Redirect URI:
http://localhost:4002/state=C2ubRxTMwv&access_token=...
Which is missing both the /sso-callback path and the # needed to distinguish the OAuth params when using response_type=token
Google API Settings:
Not sure if this is a config issue, or a Google issue.
When I submit this URL by pasting it in the address bar in Chrome:
https://accounts.google.com/o/oauth2/auth?scope=https://mail.google.com/&response_type=token&client_id=111111-aaaaaaaa.apps.googleusercontent.com&state=1&redirect_uri=http://localhost:3000/callback
I receive a redirect to
http://localhost:3000/callback#state=1&access_token=ya29.A0ARrdaM-tPsT7jLIaCoVdhHo5vW71tYF1Z4ESfNNzNAh6SN7e_a4x24V0HVu4M427KF3bpWk8-Sm37oUxUHDpA-mMGJrAQPHgMlDA0suMVW2R0WBR_9vQiaPf8cMB8Tna8EH9wLSrm58PG3g30HJWUio1Ytyh&token_type=Bearer&expires_in=3599&scope=https://mail.google.com/
A few notes: Google auth server seems to only use the first redirect URI configured in Google Console. In your case it is
http://localhost:4002
Try placing your desired redirect URI
http://localhost:4002/sso-callback
in the first position in the Console.
Turns out there was an SSR redirect that was breaking the urls that I did not know about. The answer by Delta George got me to try out a few other urls which made the issue clear.
I am following Traversy Media recent tutorial on nodejs from scratch and doing every thing as he doing but I don't know why I can't use this redirecting url http://localhost:3000/auth/google/callback even though he(brad traversy the tutorial maker) can use.
instead of using
http://localhost:3000/auth/google/callback
I used
http://127.0.0.1:3000/auth/google/callback
and also used 127.0.0.1 while making any request to server in my chrome browser. localhost is not allowed to be redirect uri. I found the allowed uris list here(Scroll down the half page to find allowed list) Link of allowed redirect uris
Not sure if Google has changed their policy, but as of Jun 2021, callback url like http://localhost:3000/auth/google/callback is working.
I'm currently working on Discord OAuth2 client for my web application.
No matter how hard I try to set the redirect_uri to make discord not send the error, I can't get fix it, and I keep getting this message:
Invalid OAuth2 redirect_uri : You can now close this tab.
(sorry for the foreign language in the second line)
My redirect_uri is:
const redirect = encodeURIComponent("http://localhost/callback");
(the website exists on the server and works as should.)
**I tried so many combinations, including:
- adding https:// instead of http://
- adding .com to the domain
- adding a slash after the word callback
- using normal string instead of encodeURIComponent
- generating the oauth2 redirect_uri via the Discord Developer page
**
The only thing that worked was totally removing the redirect_uri from the URL parameters, which made the app work, but didn't redirect to the correct place afterward;
(This is my oauth2 url):
https://discordapp.com/api/oauth2/authorize?client_id=${id}&redirect_uri=${redirect}&response_type=code&scope=identify%20guilds%20email,
when id = client id in string type and redirect = (above) the url
Thanks for any help.
Edit 1: setting the redirect_uri intentionally to a wrong URL, sends a JSON message saying "Badly formatted redirect_uri." (not the one visible on the screenshot!)
Edit 2: example complete url: https://discordapp.com/oauth2/authorize?client_id=528972063096963140&redirect_uri=http%3A%2F%2Flocalhost%2Fdiscord%2Fcallback&response_type=code&scope=identify%20guilds%20email
I got this issue today and after debugging a while around, I found what I was doing wrong.
While I registered my application on Discord, it asked me for a redirect_uri which we need to specify so that Discord can only allow those urls to redirect from the login page. But after fiddling a while on my project I changed the redirect url from node, which didn't match with what I already specified on Discord. That's why this issue popped up for me.
Screenshot from my discord developer dashboard (change this redirect url):
Fix: Go to Discord and update your new redirect url (as per your need). And this will fix the error on the login page that you're facing. Remember to save either by pressing enter in the field or by pressing the save-button that pops up at the bottom of the page.
Hope I could help!
I know this is resolved for a long time but i'm adding this in case someone has this issue and don't know what's happening: if you are calling the https://discord.com/api/oauth2/token endpoint to resolve a code to a token, you have to make the redirect_uri field the SAME as the one that generated the code with the https://discord.com/api/oauth2/authorize endpoint, otherwise you'll get this error. It also has to be, like mentioned above, EXACTLY (querystrings don't work) the same as one of the redirects in the redirects list of your application.
When using Next-Auth, I had success setting my redirect Url in discord settings as http://localhost:3000/api/auth/callback/discord
I'm attempting to run the project located at https://github.com/docusign/eg-03-csharp-auth-code-grant-core. I've followed all of the prerequisite steps listed in their read me file, have a newly generated Integration Key and Secret Key, and when I build the project in visual studio it runs without errors.
The problem is, whenever I try to sample links it redirects me to a docusign authorization page and when I put in my credentials it just gives me the message "The redirect URI is not registered properly with DocuSign".
I've gone to the admin portion of my developer sandbox and added the URL my project is running on http://localhost:8080. I also added in a second URL for where the example code should bring me http://localhost:8080/dsReturn, but I keep getting the same issue and I'm having trouble finding help online.
Could anyone help me with this? What else do I need to change?
The project runs on the following URL/port:this is the port the base project runs on
If your application is running on http://localhost:8080, the Redirect URI you register in DocuSign should be http://localhost:8080/ds/callback.
Note that the redirect URI is a specific landing page within the project, not the base domain.
Make sure that the URLs are registered for the correct integration key (clientId) you may have a mismatch between the IK you use in your code and the one you used to configure the redirect URI.
It take 2-5 minutes for updates you make to be reflected, make sure to wait a few minutes and try again.
URL must match exactly, http or https doesn't match
Confirm your port #. 8080 is not usually what IIS express is using.
i am running the DOCUSIGN example code "eg-03-node-auth-code-grant" to check how embedded signing works(at https://localhost:5000). So after the signing is complete i would want it to return to another app. I have my other app running at localhost:8080.
In the Docusign developer sandbox account, i have added "https://localhost:8080/ds/callback" in the list of redirect URLs.
When i test the embedded signing code now, it gives me an error saying "Redirect URI is not registered properly with docusign"
What I ideally want is to build a separate docusign app for a consent process. once the consent is done, it goes to my other application to complete the rest of the study. For now, i was testing out with the example code it it redirects to another app but it doesnt. Am I missing something? other than registering the redirect URI in the integration key page, is there any change i need to make in the demo code for embedded signing to make it work?
As said in support : "There are two primary causes of this error, either an incorrect URI is being passed to DocuSign, or a correct URI has not been registered for the integration key."
I had the same problem, so i realized that appUrl was http://localhost:8080/ds/callback, but should be http:localhost:8080.
So you have to add too a Redirect URI of http://localhost:8080/ds/callback to your Integration Key in your eSignature Admin.
I hope i was clear and sorry for my bad english.
It's possible you're using incorrect environment, use account-d.docusign.com for Demo and account.docusign.com for Production when requesting for authorization code grant.
could this be https vs. http situation?
are you running it on your local at https://localhost:8080/ds/callback or http://localhost:8080/ds/callback? please check. It has to match exactly the same
Another thing to check is the use of trailing slashes in app_url. While my case related to the PHP Quickstart, it's possible this affects the others as well.
My Quickstart application was installed to a subdirectory, at https://example.com/docusign/public/. So the redirect URI was set in the DocuSign dashboard as https://example.com/docusign/public/index.php?page=ds_callback - which is correct but I was still getting the "not registered properly" error.
It turns out that the app_url in /docusign/ds_config.php must not have a trailing slash, so
'app_url' => 'https://example.com/docusign/public', // The url of the application.
works but
'app_url' => 'https://example.com/docusign/public/', // The url of the application.
fails with this error.
You just need to add http://localhost:8080/login like the redirect URI in Docusign and you won't see the error message "The redirect URI is not registered properly with DocuSign" again. It's working for me.
you also need to add a redirect URI for each scenario as in: https://localhost:8080/ds/callback,
https://localhost:8080/ds/callback#/username,
https://localhost:8080/ds/callback#/password
Make sure the protocols are also the same
In ds_config.php there is a comment under app_url saying
// Ie, the user enters app_url in their browser to bring up the app's home page
// Eg http://localhost/code-examples-php/public (no trailing slash) if the app is installed in a
// development directory that is accessible via web server.
// NOTE => You must add a Redirect URI of app_url/index.php?page=ds_callback to your Integration Key.
So try adding this to your Integration Key -> Redirect URI, In my case I'm using port 8080.
http://localhost:8080/public/index.php?page=ds_callback
This works for me.