Authorization error while implementing google auhentication in django app - django

In my django project I have added google authentication API for user login and have deployed that project in heroku server[https://artgreeh.herokuapp.com]. I tried login through Google it worked with no issue in some machine but it's showing error in other machine. error image. In the google I have given redirect url-"https://artgreeh.herokuapp.com/accounts/google/login/callback/". If something is wrong with redirect url then it should not work in any device but it's working in some device.

I replaced "https" with "http" in the redirect url and it worked.

Related

redirect_uri Parameter error on WeChat SSO on redirection of authentication url

I am implementing WeChat SSO for my web application, I have developer account, created an application there, followed this article exactly. I am using React on front-end and flask on backend.
I am using this package for flask for WeChat-sso.
So in my weChat dashboard I have registered official website e.g (chess.com), but I have to use callback url in such way so I can test redirection on my dev server.
My dev front-end is on (localhost:8000/)
My backend server is running on (127.0.0.1:5050/)
I have tried saving different callback urls e.g (127.0.0.1:5050/api/users/wechat/callback), no matter what I save in callback url always receiving parameter error.
So my question is how do I actually achieve this functionality locally? Instead of parameter error I should be seeing QR code so that I can get code from which I can get access_token. Following code generates authentication url
from weixin import WXAPPAPI
from weixin.lib.wxcrypt import WXBizDataCrypt
from weixin.client import WeixinAPI
scope = ("snsapi_login",)
api = WeixinAPI(appid=WECHAT_APP_ID,
app_secret=WECHAT_APP_SECRET,
redirect_uri=WECHAT_REDIRECT_URI)
authorize_url = api.get_authorize_url(scope=scope)
The authentication url generated is as follows, redirect URI is properly encoded just like in the documentation.
https://open.weixin.qq.com/connect/qrconnect?appid=wx35c78a124e8f027b&redirect_uri=127.0.0.1%3A5050%2Fapi%2Fusers%2Fwechat%2Fcallback&response_type=code&scope=snsapi_base&state=689db1f29605481a492639e98c7b1f9f#wechat_redirect
Please look at the picture of error as well thanks

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.

Can't Load URL - facebook login on the app

I am trying to implement fb login on my game https://ski-jumps.pl.
I prepared the application (settings below) and the script here: https://ski-jumps.pl/facebook.php
Unfortunately when I try to log in this app, a message is displayed: "Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings."
What am I doing wrong? Some ideas?
application settings
I had the same problem, struggled for hours. I fixed it by providing following url in the Valid OAuth Redirect URIs of the Facebook Login product
https://mysubdomain.azurewebsites.net/signin-facebook
Regard the signin-facebook, which isn't something I provide. I found this is the url of the Facebook error page.

Facebook login app not working due to OAuthException related to app domain. (Hosted on AWS running Flask)

We are running a small Flask based server on one of our AWS machine.
It is currently up and running at following locations:
ec2-52-37-251-245.us-west-2.compute.amazonaws.com
52.37.251.245
linkcuration.ddns.net
However, when we click on Facebook login, we are getting OAuthException code 191. It is related to Facebook not able to find domain for the app.
{
"error": {
"message": "Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.",
"type": "OAuthException",
"code": 191,
"fbtrace_id": "BUcMBX9EExx"
}
}
Now, we have tried multiple solutions suggested on stackoverflow including:
appending URL with using xip.io
getting free domain name from no-ip
keeping app domain blank
adding redirect URL in OAuth redirect URL
Making app public
Unfortunately nothing has been working so far. Facebook login and app works fine on our local machine with localhost as a server name. Issue is only while hosting server on AWS.
We tried adding below pairs of App domain and site-URLs but none of them are working and we are also not able to find any working solution.
OAuthException -
ec2-52-37-251-245.us-west-2.compute.amazonaws.com and
ec2-52-37-251-245.us-west-2.compute.amazonaws.com
Facebook not allowing below domain saying top level domain not allowed -
us-west-2.compute.amazonaws.com and
ec2-52-37-251-245.us-west-2.compute.amazonaws.com
Facebook not allowing below domain saying top level domain not allowed -
compute.amazonaws.com and
ec2-52-37-251-245.us-west-2.compute.amazonaws.com
Facebook not allowing below domain saying top level domain not allowed -
amazonaws.com and
ec2-52-37-251-245.us-west-2.compute.amazonaws.com
Facebook not allowing below domain saying top level domain not allowed -
ddns.net and linkcuration.ddns.net
OAuthException -
linkcuration.ddns.net and linkcuration.ddns.net
OAuthException -
xip.io and 52.37.251.245.xip.io
Our server code is available at:
https://github.com/karishma-sureka/museum_link_curation
oauth.py file has OAuth related code
https://github.com/karishma-sureka/museum_link_curation/blob/master/oauth.py
Can someone please help us what we are missing here?
Thanks a lot!

Google Login error with django-social-auth

I'd created a django project for sign in with google using django-social-auth.
I'd followed the doc and created an app in google developer console with "OAuth 2.0" and added API's of
Gmail API, Google+ API, Google+ Domains API and Google+ Hangouts API
In Credentials I've set up AUTHORIZED REDIRECT URIS to my production server url "mysite.com".
I'd configured django settings with the "CLIENT ID" and "CLIENT SECRET". This set up works perfectly on my local server, user is created and the email is associated for the user.
But when I moved to the production server, I get the error
"400. That’s an error. OpenID auth request contains an unregistered domain: mysite.com".
Did any one else faces a similar issue?
I also had the similar issue and I fixed it as follows:
If your google login URL is /login/google/, change it to /login/google-oauth2/
Add the following redirect URIs in your google app settings
http://<your domain>/<social-auth-prefix-if-any>/complete/google-oauth2/
http://<your domain>/<social-auth-prefix-if-any>/associate/complete/google-oauth2/
Hope this helps.