Closed L4stIdi0t closed 4 months ago
Hi @L4stIdi0t, sorry to hear about the issue, but I am unsure I understand what you are trying to do.
Thank you for the fast response @ArtyomVancyan
i use domain.com/oauth/github/authorize and then let it do its thing like you would in the example
the github repo that i invited you contains all files which interact with oauth2-fastapi and my requirements.txt from pip freeze
i have never gotten it to work, i tried porting it from the example to mine, but i do not see where i messed up, i believe the token shouldnt give a 401 because of jwt_create erroring, because from what i can see both enviroments get the same input data, the same token_data
i tried reinstalling it with a clean venv and only using oauth2, uvicorn and sqlalchemy
Could you please also commit the models and database so I can run and debug them?
Added them
Okay, I had to flatten the files and comment on some database-related stuff to be able to run the app. However, the jwt_create
is used to create your JWT with your desired payload. I am not sure exactly what step the 401 status code threw. Please try to run the https://github.com/pysnippet/fastapi-oauth2/tree/master/examples/demonstration without making any code changes. If it runs without any issues, then the problem is in your implementation; otherwise, it is a problem with the library (less possible, because I just tested it and did not get any errors). What I am guessing is that you tried to create a token using the jwt_create
and call a GitHub API which could result in 401. If you want to use your access token after user authentication, you can get it from the request context (see the docs).
Thank you for your time and sorry for wasting it @ArtyomVancyan. I had a small typo in my .env file and that is why it did not work
Bug description
It throws the following error Expecting a string- or bytes-formatted key. with a 401 return
Reproduction URL
No response
Reproduction steps
I am trying to use the code from the example in my own setup but i always get 401
on the left my own enviroment, on the right the example from the repo
and it throws this error: Expecting a string- or bytes-formatted key. with a 401 return
Screenshots
Logs
No response
Browsers
No response
OS
No response