Skip to content

Instantly share code, notes, and snippets.

@toughrogrammer
Created May 23, 2016 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toughrogrammer/b353a7568884b993e0361e29f2b395cd to your computer and use it in GitHub Desktop.
Save toughrogrammer/b353a7568884b993e0361e29f2b395cd to your computer and use it in GitHub Desktop.
@app.route('/oauth/login', methods=['GET'])
def oauth_login():
form_data = {
'code': request.args['code'],
'redirect_uri': url_for('oauth_login', _external=True),
'grant_type': 'authorization_code',
'client_id': app.config.get('OAUTH_CLIENT_ID'),
'client_secret': app.config.get('OAUTH_CLIENT_SECRET'),
'scope': 'god'
}
response = RequestOauth.get_token(form_data)
oauth_access_token = response['access_token']
oauth_refresh_token = response['refresh_token']
params = parse_qs(urlparse(request.referrer).query)
next_url = params['next'][0] if 'next' in params else url_for('root')
response = make_response(render_template('jump.html', next=next_url))
return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment