Skip to content

Instantly share code, notes, and snippets.

@umbum

umbum/app.py

Created Jan 19, 2019
Embed
What would you like to do?
OAuth callback server
from flask import Flask, request
import requests
import json
app = Flask(__name__)
@app.route("/callback")
def callback():
code = request.args.get("code")
data = {
"client_id" : "deadbeef3b147d012f8b",
"client_secret" : "9eeeeeeeeee9999999aaaaaaaabbbbbffff11101",
"code" : code
}
headers = {
"accept" : "application/json"
}
r = requests.post("https://github.com/login/oauth/access_token", data=data, headers=headers)
res = r.json()
return res.get("access_token")
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8182)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.