File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change 17
17
import requests
18
18
19
19
import google .auth .transport .requests
20
- import google .auth . compute_engine
20
+ from google .oauth2 import id_token
21
21
22
22
23
23
# If `entrypoint` is not defined in app.yaml, App Engine will look for an app
32
32
@app .route ("/" )
33
33
def hello ():
34
34
"""Return a friendly HTTP greeting."""
35
- credentials = google .auth .compute_engine .IDTokenCredentials (
36
- http_request , "target_audience" , use_metadata_identity_endpoint = True
37
- )
38
35
try :
39
- credentials . refresh (http_request )
36
+ token = id_token . fetch_id_token (http_request , "https://pubsub.googleapis.com" )
40
37
except Exception as e :
41
38
return str (e )
42
39
#return credentials.token
43
- return "hello world"
40
+ return token
44
41
45
42
46
43
if __name__ == "__main__" :
Original file line number Diff line number Diff line change 1
1
Flask == 1.1.1
2
2
requests
3
- git+https://github.com/googleapis/google-auth-library-python.git#egg=google_auth
3
+ git+https://github.com/googleapis/google-auth-library-python.git@665a831dc88c034b09accdc4576a1f1f74cda509 #egg=google_auth
You can’t perform that action at this time.
0 commit comments