librelist archives

« back to archive

Flask-login auth tokens

Flask-login auth tokens

Ben Judson
2012-10-15 @ 22:29
I have flask-login installed, and it seems to be setup correctly, but it 
is not using get_auth_token() to generate the session token, and also 
doesn't seem to be using the token_loader callback to check the user. 

If I call login_user(user), this returns true and I get the correct user 
with current_user. But the token the browser gets back is like this:


Whereas the one that would be generated by my custom get_auth_token() 
function looks like this:


If I call the relevant functions manually, everything seems to work:
u = app.login_manager.user_callback(unicode(id))
token = u.get_auth_token()
uu = app.login_manager.token_callback(token)

This logs the correct user with no problems. But the callbacks are never 
run when simply using the login_user() function, nor is get_auth_token().

Any ideas what I'm missing here?