Skip to content

Commit

Permalink
fix: downscoping documentation bugs (#830)
Browse files Browse the repository at this point in the history
Fixes the following issues:

- Change `google.oauth2.Credentials` to `google.oauth2.credentials.Credentials`
- Replace deprecated `blob.download_as_string()` with `blob.download_as_bytes()`
  • Loading branch information
bojeil-google committed Aug 10, 2021
1 parent d1840dc commit da8bb13
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/user-guide.rst
Expand Up @@ -507,7 +507,7 @@ Token Consumer ::
# refresh handler to handle token expiration. Passing the original
# downscoped token or the expiry here is optional, as the refresh_handler
# will generate the downscoped token on demand.
credentials = google.oauth2.Credentials(
credentials = google.oauth2.credentials.Credentials(
downscoped_token,
expiry=expiry,
scopes=['https://www.googleapis.com/auth/cloud-platform'],
Expand All @@ -521,7 +521,7 @@ Token Consumer ::
# in bucket "bucket-123".
bucket = storage_client.bucket('bucket-123')
blob = bucket.blob('customer-a-data.txt')
print(blob.download_as_string())
print(blob.download_as_bytes().decode("utf-8"))


Another reason to use downscoped credentials is to ensure tokens in flight
Expand Down

0 comments on commit da8bb13

Please sign in to comment.