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

Remove dependancy on `user_loader` #160

Closed
immunda opened this Issue May 19, 2014 · 3 comments

Comments

Projects
None yet
3 participants
@immunda
Copy link

immunda commented May 19, 2014

I'm not sure why this needs to exist if I were to use a token_loader.

My authentication is backed by an API, so only having to use user_id and user_loader won't work (it requires authentication by token to retrieve sensitive data).

Currently I'm just using the default user_loader but with the ID argument used as the token.

Any clarification about this? The documentation is also pretty thin on the ground about token_loader.

@alanhamlett

This comment has been minimized.

Copy link
Collaborator

alanhamlett commented May 20, 2014

What you want is request_loader.

That way you get access to the whole request to authenticate using an api key/token.

The example here shows how to login a user using an api key passed in a url argument or a header.

@immunda

This comment has been minimized.

Copy link
Author

immunda commented May 27, 2014

Thanks @alanhamlett. However, I'm actually looking to get access to the whole session. Or at least have more customisation over what to store and retrieve from the session.

@alanhamlett

This comment has been minimized.

Copy link
Collaborator

alanhamlett commented May 27, 2014

Flask makes the session available wherever you are. Just import it directly from flask in your request_loader:

from flask import session

More info here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment