I am making this app using python, Flask_OAuthlib, and heroku to get access to the public repo of user's Github and create a repo and copy the required files over there. The app gets connected and also receives the following permissions as an Authorized OAuth app.
Then I have this piece of code to create a repository in public repos space of user's Github and copy some files there
177 @app.route('/replicate', methods=['GET', 'POST'])
178 def replicate():
179
170 g = Github(theToken)
181 repo_name = request.form['repo']
182 user = g.get_user()
183 repo = user.create_repo(repo_name)
This code is triggered when the user pushes a button and that button is only accessible only when logged in, and the app shows the user name and profile pictures from its Github. Therefore it is very well in the session with Github. But then heroku makes this error:
I can see that there is a problem with authentication. theToken
is captured this way. First I have created a theToken=None
at the top of my code, then in the /login
part I capture it as below:
78 @github.tokengetter
79 def get_github_oauth_token():
80 theToken = session.get('github_token')
81 return session.get('github_token')
I wonder what I am missing here. Thanks for your help