使用Python的Google Oauth2.0:如何限制对特定域的访问?

使用Python的Google Oauth2.0:如何限制对特定域的访问?,python,google-api,oauth-2.0,flask,Python,Google Api,Oauth 2.0,Flask,我试图理解在使用这个Python Oauth2.0示例时如何限制对应用程序的访问。我见过一些地方,你可以在授权url的末尾添加一个hd=domain.com,但这对我不起作用 根据这个例子,谁能解释一下如何限制对我的flask应用程序的访问? 所以我可以自己回答这个问题。构建google对象时,应添加“hd”参数 google = oauth.remote_app('google', base_url='https://www.google.com/a

我试图理解在使用这个Python Oauth2.0示例时如何限制对应用程序的访问。我见过一些地方,你可以在授权url的末尾添加一个hd=domain.com,但这对我不起作用

根据这个例子,谁能解释一下如何限制对我的flask应用程序的访问?
所以我可以自己回答这个问题。构建google对象时,应添加“hd”参数

google = oauth.remote_app('google',
                      base_url='https://www.google.com/accounts/',
                      authorize_url='https://accounts.google.com/o/oauth2/auth',
                      request_token_url=None,
                      request_token_params={'scope': 'https://www.googleapis.com/auth/userinfo.email',
                                            'response_type': 'code',
                                            'hd':'domain.com'},
                      access_token_url='https://accounts.google.com/o/oauth2/token',
                      access_token_method='POST',
                      access_token_params={'grant_type': 'authorization_code'},
                      consumer_key=GOOGLE_CLIENT_ID,
                      consumer_secret=GOOGLE_CLIENT_SECRET)