Django allauth Access blocked: This app’s request is invalid - django

I'm using django allauth. Everything working fine, except when trying to signup using Google. I got this error: Access blocked: This app’s request is invalid.
Is there any solution to this?
Here is my Google Developer Console:
I've also tried to change http to https and it's also not working

You url is not matching with google url please correct your url in Clound console.

So in my case, what I have to do is change the Authorized redirect URLs from:
http://localhost:8000/accounts/google/login/callback/
http://127.0.0.1:8000/accounts/google/login/callback/
to
http://localhost:8000/google/login/callback/
http://127.0.0.1:8000/google/login/callback/
just remove the "accounts/" and it works fine.

Related

Django allauth google OAuth redirect_uri_mismatch error

I am using Google OAuth for my Django App (via allauth package)
I have followed all standard configuration steps. In Google Developer console here's what i have:
Authorized JavaScript origins
https://example.com
Authorized redirect URIs
https://example.com/accounts/google/login/callback/ - login fails
http://example.com/accounts/google/login/callback/ - login succeeds
What i observe that if i have a https redirect URL in Authorized redirect URIs, it does not allow login and it fails with redirect_uri_mismatch Error. If i have a http redirect URL then the login succeeds.
What do i need to do to have a https enabled redirect URL ?
Adding the following in production settings.py fixed the problem for me:
ACCOUNT_DEFAULT_HTTP_PROTOCOL='https'
**This worked for me :
Go to https://console.developers.google.com
Add without port http://127.0.0.1/accounts/google/login/callback/
Also Add http://localhost/accounts/google/login/callback/
see the image in the link for detail
In my case, the problem was in the following:
My website switched the access to HTTPS-only connections, while in Google API dashboard was http://profile.example.com/accounts/google/login/callback/.
So, I changed:
from http -> https and it begins to work fine.

Facebook login is not working on website

can someone please help me. I am getting the following error when trying to login with Facebook:
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.
My redirect URI is: http://127.0.0.1:8000/auth/complete/facebook
you can change your URI from this:
http://127.0.0.1:8000/auth/complete/facebook
to this:
http://127.0.0.1:8000/en/auth/complete/facebook
you can add for each tranlation you may add. (en, fr, etc)
Hope it helps.

Facebook Login Api Error even domain has lets encrypt SSL - Insecure Login

Insecure Login Blocked: You can't get an access token or log in to this app from an insecure page. Try re-loading the page as https://
Error message says there is no SSL at your domain which you tried to use the API, but I already added it to Valid OAuth Redirect URIs so this makes no sense.
Cause validator says this is a valid redirect URI for this application and I am using a wordpress plugin named Woocommerce Social Login. Its settings also offering the valid URI.
What can be the cause now? They(FB) don't accept the Lets Encrypt SSL as an SSL anymore?
I have fixed the situation by just checkin the url requested when we try to login with facebook, it shows http instead of https. So the source of the problem is wordpress social login plugin.
https://www.facebook.com/v2.8/dialog/oauth?client_id=<ClientID>&redirect_uri=http%3A%2F%2example.com%2F%3Fwc-api%3Dauth%26done%3Dfacebook&response_type=code&scope=public_profile%2C%20email

Django-allauth Facebook error

I am going to implement login with facebook and google using django-allauth app,but i am getting one error i.e
You are not logged in: You are not logged in. Please log in and try again.
My Facebook App Settings
What should i do now??
Change your redirect URI to
http://localhost:8000/accounts/facebook/login/callback/
and also make sure to have SITE_ID = 1 in settings.
The following solved my problem:
Valid Oauth redirect URI ---> set to http://localhost:8000/

Google OAuth throwing edirect_uri_mismatch error

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.