The /user route in example.py gives me 401 Bad Credentials.
gaurcs opened this issue · comments
So I ran the example.py as per the docs. I am able to authenticate with my app but I don't think it is saving the logged in user. So when I go to /user after the authentication, it gives me flask_github.GitHubError: 401: Bad credentials
Do I need to save g.user somewhere? What is the purpose of that /user route?
Hello @gaurcs,
The user is saved when you return back from Github at
Line 98 in a65bae8
user_id
is also saved in the session so application can recognize the user. It is loaded at the beginning of every request at:
Line 59 in a65bae8
The purpose of the /user
route is an example to show how to use the library to make a request. It return the account information of the logged in user. Example: https://cl.ly/tPV5 and https://developer.github.com/v3/users/#get-the-authenticated-user
You can;
- Make sure you have a session cookie in your browser.
- Try with another browser.
- Remove
/tmp/github-flask.db
and try again.
That's what comes to my mind now. Please let me know if your issue is not resolved.
Hello @cenkalti
thanks for quick response. I tried doing all these three. Still the same error. This is the screenshot if you are interested. https://ibb.co/hhmerK
Is it something related to my Authorization callback URL in github config. I don't think that matters though.