AWS Security ChangesHomeSearch

AWS bedrock-agentcore documentation change

Service: bedrock-agentcore · 2025-10-01 · Documentation low

File: bedrock-agentcore/latest/devguide/identity-getting-started-step4.md

Summary

Improved code formatting and error handling in Google Drive API integration example

Security assessment

Changes focus on code structure and readability improvements rather than addressing security concerns or adding security-related documentation.

Diff

diff --git a/bedrock-agentcore/latest/devguide/identity-getting-started-step4.md b/bedrock-agentcore/latest/devguide/identity-getting-started-step4.md
index a9c0d45cc..5341def64 100644
--- a//bedrock-agentcore/latest/devguide/identity-getting-started-step4.md
+++ b//bedrock-agentcore/latest/devguide/identity-getting-started-step4.md
@@ -34,6 +34,22 @@ Then, copy the following code:
-        creds= Credentials(token= access_token, scopes= SCOPES)try:
-            service= build("drive", "v3", credentials= creds)# Call the Drive v3 API
-            results= (service.files().list(pageSize= 10, fields= "nextPageToken, files(id, name)").execute())items= results.get("files", [])if not items:
-                print("No files found.")return
-            print("Files:")for item in items:
-                print(f"{item['name']}({item['id']})")except HttpError as error:
+        creds = Credentials(token=access_token, scopes=SCOPES)
+        
+        try:
+            service = build("drive", "v3", credentials=creds)
+            
+            # Call the Drive v3 API
+            results = (
+                service.files()
+                .list(pageSize=10, fields="nextPageToken, files(id, name)")
+                .execute()
+            )
+            items = results.get("files", [])
+    
+            if not items:
+                print("No files found.")
+                return
+                
+            print("Files:")
+            for item in items:
+                print(f"{item['name']} ({item['id']})")
+                
+        except HttpError as error:
@@ -41 +57 @@ Then, copy the following code:
-            print(f"An error occurred: {error}")if __name__= = "__main__":
+            print(f"An error occurred: {error}")
@@ -42,0 +59 @@ Then, copy the following code:
+    if __name__ == "__main__":
@@ -44,5 +61,11 @@ Then, copy the following code:
-        @requires_access_token(provider_name= "google-provider",
-            scopes= ["https://www.googleapis.com/auth/drive.metadata.readonly"], # Google OAuth2 scopes
-            auth_flow= "USER_FEDERATION", # 3LO flow
-            on_auth_url= lambda x: print("Copy and paste this authorization url to your browser", x), # prints authorization URL to console
-            force_authentication= True,)async def read_from_google_drive(*, access_token: str):
+        @requires_access_token(
+            provider_name="google-provider",
+            # Google OAuth2 scopes
+            scopes=["https://www.googleapis.com/auth/drive.metadata.readonly"],
+            # 3LO flow
+            auth_flow="USER_FEDERATION",
+            # prints authorization URL to console
+            on_auth_url=lambda x: print("Copy and paste this authorization url to your browser", x),
+            force_authentication=True,
+        )
+        async def read_from_google_drive(*, access_token: str):
@@ -51 +74,3 @@ Then, copy the following code:
-            main(access_token)asyncio.run(read_from_google_drive(access_token= ""))
+            main(access_token)
+    
+        asyncio.run(read_from_google_drive(access_token=""))