teamhide / fastapi-boilerplate

FastAPI boilerplate for real world production
1.07k stars 170 forks source link

Code revision #16

Open thomaslc66 opened 1 year ago

thomaslc66 commented 1 year ago

Hello how are you?

Just tried to use your boilerplate and wanted to thank you for the work.

I've want to know if you've been able to start it from scratch without having errors?

You don't describe for example that you need to run some alembic commands first, you don't have a requierments.txt to install all the dependencies, maybe there something I'm missing with poetry but still you are importing jwt and it seems that jwt doesn't have anymore and *.encode method, but the JWT class does, thus it seems that some of the code is broken.

I wanted to use a boilerplate to start clean an fresh but I think I will lose less time to do it on my own.

Maybe you might want to check back you code a bit. I don't know.

Thank you anyway.

thomaslc66 commented 1 year ago

I've check again the code, and if you send you add your token (after login) to the swagger authorize pop-up you are authorized.

But then if you try to search for the list of user, you get a permission denied with an 401 Unauthorized.

So I've checked the AuthBackend -> authenticate method, and you are getting the authorization from conn.headers.get('Authorization') and then trying to split and find the "bearer" string inside, but there's no bearer passed in the Authorization header so it's not working.

Maybe you can also have a look, why from the swagger get user list endpoint there is not the bearer token that is passed throught.