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

Custom options in user_loader #24

Open
dhararon opened this issue Apr 21, 2019 · 2 comments
Open

Custom options in user_loader #24

dhararon opened this issue Apr 21, 2019 · 2 comments

Comments

@dhararon
Copy link

I was trying to pass my custom options but user_loader just accept one parameter, maybe add **kwargs or something like that.

I convert the parameter to dictionary for my business logic, maybe is not the best or cleaned but i think it's necessary.

My use case was: #23

I have 2 middlewares:
1) read the headers and apply some server configurations
2) connect to the database and create a param into the req object for global access

If i want to check my database looking for the token i need to create a connection into the user_loader funtion and i can reuse my custom middleware (DRU)

I expect we will take a virtual coffe and discuss this topic.

I appreciate your attention and love you tool ;)

@jcwilson
Copy link
Collaborator

jcwilson commented Apr 22, 2019

Thanks for the context on this one. See my comments on #23 on how we might proceed here. Any change we make here would be an interface-breaking change and would warrant a major version bump.

I have recently pushed tags for the commits that I would hope could become releases on PyPI (i don't have PyPI push access), but users of this library can use git+git references in their requirements lists to get the latest code without PyPI.

@dhararon
Copy link
Author

dhararon commented Apr 22, 2019

Hey @jcwilson i take some time for make the changes that you writed in #23 , you was rigth the dic is not the best way to figure out the problem.

I change the dict to parameters in that way the user_loader can be

def user_loader(token, req, resource):
    # Some authentication things

or

def user_loader(token, **kwargs):
    # Some authentication things

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

2 participants