diff --git a/app/en/resources/faq/page.mdx b/app/en/resources/faq/page.mdx index c831a9deb..b00f027bd 100644 --- a/app/en/resources/faq/page.mdx +++ b/app/en/resources/faq/page.mdx @@ -53,6 +53,7 @@ Tools](/references/auth-providers/google, you can use this code to authenticate + ```python from arcadepy import Arcade @@ -60,29 +61,26 @@ client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable USER_ID = "{arcade_user_id}" # get the list of tools - tools = client.tools.list(toolkit="Gmail") # collect the scopes - scopes = set() for tool in tools: -if tool.requirements.authorization.oauth2.scopes: -scopes |= set(tool.requirements.authorization.oauth2.scopes) + if tool.requirements.authorization.oauth2.scopes: + scopes |= set(tool.requirements.authorization.oauth2.scopes) # start auth - auth_response = client.auth.start(user_id=USER_ID, scopes=list(scopes), provider="google") # show the url to the user if needed - if auth_response.status != "complete": -print(f"Please click here to authorize: {auth_response.url}") # Wait for the authorization to complete -client.auth.wait_for_completion(auth_response) + print(f"Please click here to authorize: {auth_response.url}") # Wait for the authorization to complete + client.auth.wait_for_completion(auth_response) +``` -```` + ```js import Arcade from "@arcadeai/arcadejs"; @@ -107,7 +105,7 @@ if (auth_response.status !== "completed") { // Wait for the authorization to complete auth_response = await client.auth.waitForCompletion(auth_response); } -```` +``` @@ -122,6 +120,7 @@ The tool will work with the broader permissions while still satisfying its minim + ```python from arcadepy import Arcade @@ -129,17 +128,19 @@ client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable user_id = "{arcade_user_id}" auth_response = client.auth.start( -user_id=user_id, -provider="google", -scopes=[ -"https://www.googleapis.com/auth/drive.file", -"https://www.googleapis.com/auth/drive" -] + user_id=user_id, + provider="google", + scopes=[ + "https://www.googleapis.com/auth/drive.file", + "https://www.googleapis.com/auth/drive" + ] ) -```` +``` + + ```javascript import Arcade from "@arcadeai/arcadejs"; @@ -149,7 +150,7 @@ const user_id = "{arcade_user_id}"; const authResponse = await client.auth.start(user_id, "google", { scopes: ["https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive"] }); -```` +```