Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions app/en/resources/faq/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,36 +53,34 @@ Tools](/references/auth-providers/google, you can use this code to authenticate

<Tabs items={["Python", "JavaScript"]} storageKey="preferredLanguage">
<Tabs.Tab>

```python
from arcadepy import Arcade

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)
```

````
</Tabs.Tab>
<Tabs.Tab>

```js
import Arcade from "@arcadeai/arcadejs";

Expand All @@ -107,7 +105,7 @@ if (auth_response.status !== "completed") {
// Wait for the authorization to complete
auth_response = await client.auth.waitForCompletion(auth_response);
}
````
```

</Tabs.Tab>
</Tabs>
Expand All @@ -122,24 +120,27 @@ The tool will work with the broader permissions while still satisfying its minim

<Tabs items={["Python", "JavaScript"]} storageKey="preferredLanguage">
<Tabs.Tab>

```python
from arcadepy import Arcade

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"
]
)

````
```

</Tabs.Tab>
<Tabs.Tab>

```javascript
import Arcade from "@arcadeai/arcadejs";

Expand All @@ -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"]
});
````
```

</Tabs.Tab>
</Tabs>
Expand Down