app.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Office365-SharePoint-Python-Flask-Sample 作者: OneBitSoftware 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号