Comments (4)
I'm getting the same behavior (infinite redirect loop), although unfortunately it is intermittent and seems to only occur on the production site (I cannot reproduce it when running the Flask app locally). Were you ever able to solve your problem?
from flask-googlelogin.
Nope. Just kinda moved on. Sorry not more help.
from flask-googlelogin.
Sorry I haven't been able to check on this.
@dsavransky What's different between your local and prod setup/settings?
from flask-googlelogin.
The only real difference is that the production setup is ssl only. So, for local I have:
GOOGLE_LOGIN_REDIRECT_URI='http://localhost:5000/oauth2callback',
GOOGLE_LOGIN_REDIRECT_SCHEME = "http"
and for production:
GOOGLE_LOGIN_REDIRECT_URI='https://servername/oauth2callback',
GOOGLE_LOGIN_REDIRECT_SCHEME = "https"
I am testing login attempts against an internal database of authorized users, so I know that google is actually returning valid information each time (bad login attempts are logged and do not occur when the redirect loop is happening). Here's the oauth2 function:
@app.route('/oauth2callback')
@googlelogin.oauth2callback
def login(token, userinfo, **params):
"""Grab the allowed users"""
"""code returns allowed_user boolean from internal db""""
if not allowed_user:
logging.warning('Bad login attempt by %s', userinfo['email'])
abort(401)
user = users[userinfo['id']] = User(userinfo)
login_user(user)
session['token'] = json.dumps(token)
session['extra'] = params.get('extra')
logging.info('Logged in %s', userinfo['email'])
return redirect(params.get('next', url_for('home')))
I also tried logging current_user.is_authenticated() and it always returns true during a loop, so it seems like login_user is working.
The final difference is that the local version is not really run for long periods of time. On the live version, the loops tend to occur after a user has been logged in for a while. Possibly some kind of expiration mismatch? The cookies generated for the site are all set to expire with the session.
Any ideas? Thanks.
Update: So, switching the wsgi application to running in daemon mode (it was previously running embedded) appears to have completely eliminated the problem No idea why...
from flask-googlelogin.
Related Issues (14)
- Version bump 0.0.3 -> 0.0.4 breaks compatibility. HOT 1
- _scheme arg in oath2callback decorator causes problems
- __init__ should pass login_manager instance to init_app?
- Pass 'postmessage' as redirect_uri to support Google+ javascript API
- Getting "Bad Request" back after authenticating HOT 4
- pip installs version with old requests dependency HOT 2
- 'function' has no attribute 'get' HOT 1
- Multiple scopes in an app
- Requests library compatibility issue with chardet2 HOT 1
- Fix default next param value HOT 3
- Use offline tokens to have access indefinitely until logout
- UnicodeDecodeError with SECRET_KEY not ascii HOT 1
- Update docs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-googlelogin.