Skip to content

Commit 96a614a

Browse files
author
Jon Wayne Parrott
committed
Fix signing with app engine signer
Change-Id: Ie82e5734514ab52be655815463778b3f9a64b382
1 parent 9f2f66f commit 96a614a

File tree

1 file changed

+8
-3
lines changed
  • appengine/standard/flask/hello_world

1 file changed

+8
-3
lines changed

appengine/standard/flask/hello_world/main.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from flask import Flask
1919

2020
import google.auth
21+
import google.auth.app_engine
2122
import google.auth.transport.requests
2223
from google.oauth2 import service_account
2324
import google.oauth2._client
@@ -33,10 +34,14 @@
3334

3435

3536
def get_open_id_connect_id_token():
36-
credentials = service_account.Credentials.from_service_account_file(
37-
'service-account.json',
37+
bootstrap_credentials = google.auth.app_engine.Credentials()
38+
signer = google.auth.app_engine.Signer()
39+
credentials = service_account.Credentials(
40+
signer,
41+
bootstrap_credentials.service_account_email,
42+
token_uri='https://www.googleapis.com/oauth2/v4/token',
3843
additional_claims={
39-
'target_audience': 'https://msachs-staging.appspot.com'
44+
'target_audience': 'http://meep'
4045
})
4146

4247
grant_assertion = credentials._make_authorization_grant_assertion()

0 commit comments

Comments
 (0)