Skip to content

Commit d32b807

Browse files
committed
Remove OAUTHLIB_RELAX_TOKEN_SCOPE flag from all examples.
Add _all_ configured scopes to all relevant examples. Change-Id: I95ed20b077f8ab0efb45e6c5311a622d164d99a5
1 parent 952e576 commit d32b807

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

flask/02-sign-in/main.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@
5151
# These scopes should match the scopes in your GCP project's OAuth Consent
5252
# Screen: https://console.cloud.google.com/apis/credentials/consent
5353
SCOPES = [
54+
"openid",
5455
"https://www.googleapis.com/auth/userinfo.profile",
55-
"https://www.googleapis.com/auth/userinfo.email"
56+
"https://www.googleapis.com/auth/userinfo.email",
57+
"https://www.googleapis.com/auth/classroom.courses.readonly",
58+
"https://www.googleapis.com/auth/classroom.addons.teacher",
59+
"https://www.googleapis.com/auth/classroom.addons.student"
5660
]
5761

5862

@@ -272,9 +276,6 @@ def credentials_to_dict(credentials):
272276

273277

274278
if __name__ == "__main__":
275-
# Allow the OAuth flow to adjust scopes.
276-
os.environ["OAUTHLIB_RELAX_TOKEN_SCOPE"] = "1"
277-
278279
# You have several options for running the web server.
279280

280281
### OPTION 1: Unsecured localhost

flask/03-query-parameters/main.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,12 @@
5252
# These scopes should match the scopes in your GCP project's OAuth Consent
5353
# Screen: https://console.cloud.google.com/apis/credentials/consent
5454
SCOPES = [
55+
"openid",
5556
"https://www.googleapis.com/auth/userinfo.profile",
56-
"https://www.googleapis.com/auth/userinfo.email"
57+
"https://www.googleapis.com/auth/userinfo.email",
58+
"https://www.googleapis.com/auth/classroom.courses.readonly",
59+
"https://www.googleapis.com/auth/classroom.addons.teacher",
60+
"https://www.googleapis.com/auth/classroom.addons.student"
5761
]
5862

5963
# Point to a database file in the project root.
@@ -429,9 +433,6 @@ def save_user_credentials(credentials=None, user_info=None):
429433

430434

431435
if __name__ == "__main__":
432-
# Allow the OAuth flow to adjust scopes.
433-
os.environ["OAUTHLIB_RELAX_TOKEN_SCOPE"] = "1"
434-
435436
# You have several options for running the web server.
436437

437438
### OPTION 1: Unsecured localhost

0 commit comments

Comments
 (0)