I'm using the excellent Django Social Auth app to handle logins from a variety of services. This works nicely with Twitter, Facebook and LinkedIn but I can't figure out why it will not work with Google. I have got this message numerous times trying all the options that I can think:
Error: redirect_uri_mismatch
Request Details
scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
response_type=code
access_type=offline
redirect_uri=http://dev.mysite.com/complete/google-oauth2/
next=/close_login_popup/
state=OHZtGyZPyrM0XUjzEsf8dv22VAZGXSY6
display=page
client_id=820357455247-4levikqugduodacfc8j3b5dhsvmbbnnb.apps.googleusercontent.com
To create the API key, I went to https://code.google.com/apis/ then filled out the form using the following steps:
Then, I chose 'Installed Application' which I don't fully understand but most documentation suggest this option. I have tried both other options without success:
If I try creating a Web Application specifying http://.dev.mysite.com I get the following error:
Error: redirect_uri_mismatch
The redirect URI in the request: http://dev.mysite.com/complete/google-oauth2/ did not match a registered redirect URI
Learn more
Request Details
scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
response_type=code
access_type=online
redirect_uri=http://dev.mysite.com/complete/google-oauth2/
next=/close_login_popup/
state=xcpu93i7XJJmYlwXnRbkfgEwsbbR1O7c
display=page
client_id=606300275392.apps.googleusercontent.com
My objective is to have a link that someone can click on, give permissions to Google and then log in to my site. I'm testing this on the actual site, wwww.dev.mysite.com and when trying the other options for key generation I specified dev.mysite.com. I would appreciate any suggestions of what to try next as I've run out of ideas.
Related
Following this guide to add google sign-in/sign-up to my django app.
Added all the code and it all seemed to be working until the very end when I got this error.
Error 400: redirect_uri_mismatch
The redirect URI in the request, http://127.0.0.1:8000/accounts/google/login/callback/, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/....
However, i visit my credential screen I do see the url correctly reported. What am i doing wrong?
problem solved itself after 1h. Probably google taking time to deploy changes in credentials
I'm trying to connect my website's API and mobile app. I need to authenticate the user with google account but I don't know how to do it.
I created the backend with Django. And I set the endpoint as rest-auth/google/. On the restframework's page, it requires Access Token and Code but honestly I don't get how I can test if it actually works using actual google account.
I want to test from mobile app but I don't understand how and what I need to POST.
Anyone could give me tips?
I would recommend you to use a ready solution like "django-allauth".
If you want to do authentication yourself you might want to read Google's documentation about the topic:
https://developers.google.com/api-client-library/python/
In nutshell you create API credentials:
https://console.cloud.google.com/apis/credentials
Send a user to a link with specific parameters (api-credentials, scope, redirect link etc). Google client can help you to generate it.
A user will login in his account as he would normally do and will give your app permissions to use his information (or won't). After that he will be redirected to the link you specified with GET request with a code as a parameter (or error).
With help of Google client you can exchange the code on a token and then use that token to get information from his profile.
I'm trying to make social login using Google, Facebook, and LinkedIn on my website
the last two works very well but Google always gives me error like this :
Forbidden
You don't have permission to access /test/login/google/callback on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
I don't know why it's only appearing with Google, can anyone help me?
The reason for getting this error is because Google+ API is not enabled
go on google console account and enable Google+ API. If you haven't known how to enable Google+ services then follow this steps:
First Open your Google Console Account from Here: console.developers.google.com
Then Go to -> library -> select Google+ API -> Enable
If you have any configuration related problem then see my GitHub code for Socialite
I am attempting to add Google Authentication to my Django project. I have been able to configure my project to work with my app on Heroku using a different Oauth client object but I can't seem to get it to work for my development server.
I keep getting the error:
Error: redirect_uri_mismatch
The JavaScript origin in the request, http://localhost:8000, does not match the ones authorized for the OAuth client.
from Google.
My Authorized Javascript origin is:
https://localhost:8000
http://localhost:8000
My Authorized Redirect URIs are:
https://localhost:8000
https://localhost:8000/
https://localhost
http://localhost:8000
http://localhost:8000/
http://localhost
(I tried all of these combos based on comments from similar questions.)
Any help or advice would be much appreciated as I can't seem to find the answer to this anywhere in the API docs.
Each time I changed the Client in the developer console I neglected to make the corresponding update in the Django template. I was using the wrong client the whole time - careless mistake.
How can I setup PAW to work with Facebook locally for development? Or even at all for that matter?
I have a node.js backend that I'm setting up with Facebook Auth. Every one of my routes needs the user to be logged in. I have two endpoints related to FB Auth. localhost:3000/api/v1/loginFB and localhost:3000/api/v1/callbackFB. Both of these work great in a web browser.
loginFB simply returns this string... https://www.facebook.com/dialog/oauth?client_id=523534457345&redirect_uri=https://localhost:3000/api/v1/callbackFB&scope=email,public_profile,user_friends.
When I call that URI in a browser, it returns a code=blahblah which my callbackFB endpoint uses to fire off another request to get the access token. All good.
So now in PAW I'm confused by the difference between the request URI and the Authorization URL text field? Should I use the loginFB URI for my request URI? And then https://www.facebook.com/dialog/oauth in the Authorization URL textfield?
Basically what's happening is that when I click Get Access Token, it returns the code but my callbackFB endpoint 500's by saying "This authorization code has been used." The code that it's getting returned is definitely different each time I Get Access Token.
This is where I'm at with this thing (Client ID and Client Secret are actually my App ID and App Secret from fb's dev management site, and the Access Token URL is actually set to https://graph.facebook.com/v2.3/oauth/access_token which I'm 99% sure is the correct URI):
This is the error I get when I click Get Access Token button:
It would be awesome to get some advice from anyone with experience with this issue. Thanks.
Re: #MichaMazaheri
tl;dr Fixed in version 2.2.2
Sorry for the super late follow-up. We actually fix this exact issue in Paw 2.2.2, which is already released on our website, and pending review for the Mac App Store. (It was some JSON vs. Form URL-Encoded parsing issue). Thanks for reporting.