Skip to content

Commit

Permalink
docs(iam-samples): extract json_key_file from privateKeyData (GoogleC…
Browse files Browse the repository at this point in the history
…loudPlatform#7393)

* docs(iam-samples): extract json_key_file from privateKeyData field in service account

* fix(iam-samples): lint fix - included base64 import

* docs(iam-samples): Updated the comment acc to review

* lint fix

* updated acc to review comment
  • Loading branch information
Sita04 authored Feb 22, 2022
1 parent 650baa8 commit 6f2f3d7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion iam/api-client/service_account_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,15 @@ def create_key(service_account_email):
name='projects/-/serviceAccounts/' + service_account_email, body={}
).execute()

print('Created key: ' + key['name'])
# The privateKeyData field contains the base64-encoded service account key
# in JSON format.
# TODO(Developer): Save the below key {json_key_file} to a secure location.
# You cannot download it again later.
# import base64
# json_key_file = base64.b64decode(key['privateKeyData']).decode('utf-8')

if not key['disabled']:
print('Created json key')
# [END iam_create_key]


Expand Down

0 comments on commit 6f2f3d7

Please sign in to comment.