GitHub-Flask Authorize Scope Issue
The login
route is only redirecting to GitHub's authorization page, it has no way to access the user data yet because the user isn't logged in. Once you get to the authorized
callback, you can make API calls to GitHub.
In the authorized
route, use github.get
to call the user
API endpoint.
data = github.get('user')email = data['email']
Also, do not use global user
to store the logged in user. See Are global variables thread safe in flask? Instead, store the user id in session
, and load the user into g
, as shown in GitHub-Flask's full example.