def home():
# Renders the home page.
redirect_uri = '{0}auth'.format(request.host_url)
# Generates Azure AD authorization endpoint url with parameters so the user authenticates and consents, if consent is required.
url = login_url(redirect_uri, c['CLIENT_ID'], c['RESOURCE'], c['AUTHORITY'])
user = {}
# Checks if access token has already been set in flask session.
if 'access_token' in session:
# Gets authenticated user details from SharePoint tenant if access token is acquired.
user = user_details(c['RESOURCE'], session['access_token'])
# Renders the index template with additional params for the login url and user.
return render_template('index.html', url=url, user=user)
app.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录