Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting "Bad Request" back after authenticating #17

Open
chromakey opened this issue Jul 28, 2014 · 4 comments
Open

Getting "Bad Request" back after authenticating #17

chromakey opened this issue Jul 28, 2014 · 4 comments

Comments

@chromakey
Copy link

After authenticating against google, I'm getting "Bad Request: The browser (or proxy) sent a request that this server could not understand." messages.

I'm using the default material in the docs with my IDs, Secret, and Redirect for what I have from Google. I'm hosting on Heroku if that matters.

googlelogin = GoogleLogin(app)
@app.route('/oauth2callback')
@googlelogin.oauth2callback
def create_or_update_user(token, userinfo, **params):
user = User.filter_by(google_id=userinfo['id']).first()
if user:
user.name = userinfo['name']
user.avatar = userinfo['picture']
else:
user = User(google_id=userinfo['id'],
name=userinfo['name'],
avatar=userinfo['picture'])
db.session.add(user)
db.session.flush()
login_user(user)
return redirect(url_for('estimator'))

@marksteve
Copy link
Contributor

Are you using https?

@chromakey
Copy link
Author

Nope. The site is just a basic calculator that I only want employees to have access to. I don't need any profile information, posting permissions, storing of credentials, etc. Since we're already using Google Apps, it would make life a lot easier on me if they could just authenticate using their accounts and then use the calculator.

@isokrates
Copy link

Three years later, I am getting exactly the same error. I've been trying to use this example: https://gist.github.com/ashish01/2a4a0f9b525096633ca2. Any ideas?

@Focshole
Copy link

Focshole commented May 21, 2018

To fix this, enable HTTPS. Google refuses HTTP connections (i don't remember where Google wrote this). Anyway, to switch to HTTPS, just add
app.config.update(GOOGLE_LOGIN_REDIRECT_SCHEME="https")
to Flask app. It should be set as default, instead of http

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants