@@ -53,36 +53,34 @@ Tools](/references/auth-providers/google, you can use this code to authenticate
5353
5454<Tabs items = { [" Python" , " JavaScript" ]} storageKey = " preferredLanguage" >
5555<Tabs.Tab >
56+
5657``` python
5758from arcadepy import Arcade
5859
5960client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable
6061USER_ID = " {arcade_user_id} "
6162
6263# get the list of tools
63-
6464tools = client.tools.list(toolkit = " Gmail" )
6565
6666# collect the scopes
67-
6867scopes = set ()
6968for tool in tools:
70- if tool.requirements.authorization.oauth2.scopes:
71- scopes |= set (tool.requirements.authorization.oauth2.scopes)
69+ if tool.requirements.authorization.oauth2.scopes:
70+ scopes |= set (tool.requirements.authorization.oauth2.scopes)
7271
7372# start auth
74-
7573auth_response = client.auth.start(user_id = USER_ID , scopes = list (scopes), provider = " google" )
7674
7775# show the url to the user if needed
78-
7976if auth_response.status != " complete" :
80- print (f " Please click here to authorize: { auth_response.url} " ) # Wait for the authorization to complete
81- client.auth.wait_for_completion(auth_response)
77+ print (f " Please click here to authorize: { auth_response.url} " ) # Wait for the authorization to complete
78+ client.auth.wait_for_completion(auth_response)
79+ ```
8280
83- ````
8481</Tabs.Tab >
8582<Tabs.Tab >
83+
8684``` js
8785import Arcade from " @arcadeai/arcadejs" ;
8886
@@ -107,7 +105,7 @@ if (auth_response.status !== "completed") {
107105 // Wait for the authorization to complete
108106 auth_response = await client .auth .waitForCompletion (auth_response);
109107}
110- ````
108+ ` ` `
111109
112110</Tabs.Tab>
113111</Tabs>
@@ -122,24 +120,27 @@ The tool will work with the broader permissions while still satisfying its minim
122120
123121<Tabs items={["Python", "JavaScript"]} storageKey="preferredLanguage">
124122<Tabs.Tab>
123+
125124` ` ` python
126125from arcadepy import Arcade
127126
128127client = Arcade () # Automatically finds the ` ARCADE_API_KEY` env variable
129128user_id = " {arcade_user_id}"
130129
131130auth_response = client .auth .start (
132- user_id = user_id,
133- provider = " google" ,
134- scopes = [
135- " https://www.googleapis.com/auth/drive.file" ,
136- " https://www.googleapis.com/auth/drive"
137- ]
131+ user_id= user_id,
132+ provider= " google" ,
133+ scopes= [
134+ " https://www.googleapis.com/auth/drive.file" ,
135+ " https://www.googleapis.com/auth/drive"
136+ ]
138137)
139138
140- ````
139+ ` ` `
140+
141141</Tabs.Tab>
142142<Tabs.Tab>
143+
143144` ` ` javascript
144145import Arcade from " @arcadeai/arcadejs" ;
145146
@@ -149,7 +150,7 @@ const user_id = "{arcade_user_id}";
149150const authResponse = await client .auth .start (user_id, " google" , {
150151 scopes: [" https://www.googleapis.com/auth/drive.file" , " https://www.googleapis.com/auth/drive" ]
151152});
152- ````
153+ ` ` `
153154
154155</Tabs.Tab>
155156</Tabs>
0 commit comments