The Wayback Machine - https://web.archive.org/web/20201201060111/https://github.com/GoogleCloudPlatform/getting-started-python/issues/165
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit OAuth 2 Client to a Google Apps Domain #165

Open
Nathaniel-MacIver opened this issue Aug 6, 2018 · 0 comments
Open

Limit OAuth 2 Client to a Google Apps Domain #165

Nathaniel-MacIver opened this issue Aug 6, 2018 · 0 comments

Comments

@Nathaniel-MacIver
Copy link

@Nathaniel-MacIver Nathaniel-MacIver commented Aug 6, 2018

I'd like to use this code as a base for a small python package I want to build in my work environment, but it has to be limited in accessibility to only gmail accounts within our GSuite Work domain. In searching for a way to tweak the OAuth client, I found this on Stackoverflow:

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)

The request_token_params dictionary permits an hd variable where you can specify the domain to lock it down to.

Where would I put this kind of variable in the Bookshelf project to practice? Would it be under service_account.py in windows directory env\Lib\site-packages\oauth2client, or somewhere else?

Thank you for your help!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.