INNER CODE UNIT · Python
login
LiuChangFreeman/OneIndexServerless · Serverless/main.py:82
def login():
code=request.args.get("code")
code=base64.b64decode(code).decode("utf-8")
final=request.args.get("final")
if code==password:
url_login="https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id={}&scope={}&response_type=code&redirect_uri={}&state={}".format(client_id, urllib.parse.quote(scopes), redirect_uri_register, redirect_uri_final+"*"+final)
return redirect(url_login)
@app.route('/login/authorized')
def authorized():
global token
try:
code=request.args.get("code")
final = request.args.get("final")
url = "https://login.microsoftonline.com/common/oauth2/v2.0/token"
headers = {
"Content-Type": "application/x-www-form-urlencoded"
}