-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.py
37 lines (29 loc) · 1.03 KB
/
server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from flask import Flask, redirect, request
from json import dumps
from urllib.parse import urlencode
app = Flask(__name__)
app.debug = True
steam_openid_url = 'https://steamcommunity.com/openid/login'
@app.route("/")
def hello():
return '<a href="http://localhost:5000/auth">Login with steam</a>'
@app.route("/auth")
def auth_with_steam():
params = {
'openid.ns': "http://specs.openid.net/auth/2.0",
'openid.identity': "http://specs.openid.net/auth/2.0/identifier_select",
'openid.claimed_id': "http://specs.openid.net/auth/2.0/identifier_select",
'openid.mode': 'checkid_setup',
'openid.return_to': 'http://127.0.0.1:5000/authorize',
'openid.realm': 'http://127.0.0.1:5000'
}
query_string = urlencode(params)
auth_url = steam_openid_url + "?" + query_string
print(auth_url)
return redirect(auth_url)
@app.route("/authorize")
def authorize():
print(request.args)
return dumps(request.args) + '<br><br><a href="http://localhost:5000/auth">Login with steam</a>'
if __name__ == "__main__":
app.run()