Merge branch 'master' into 2257-inequality-conditions
[arvados.git] / doc / user / reference / api-tokens.html.textile.liquid
1 ---
2 layout: default
3 navsection: userguide
4 title: "Getting an API token"
5 ...
6
7 The Arvados API token is a secret key that enables the @arv@ command line client to access Arvados with the proper permissions.
8
9 Access the Arvados workbench using this link: "https://{{ site.arvados_workbench_host }}/":https://{{ site.arvados_workbench_host }}/
10
11 (Replace @{{ site.arvados_api_host }}@ with the hostname of your local Arvados instance if necessary.)
12
13 First, open a shell on the system on which you intend to use the Arvados client (this may be your local workstation, or an Arvados VM, refer to "Accessing Arvados over ssh":{{site.baseurl}}/user/getting_started/ssh-access.html ) .
14
15 Click on the user icon <span class="glyphicon glyphicon-user"></span> in the upper right corner to access the user settings menu, and click on the menu item _Manage API token_ to go to the "api client authorizations" page.  
16
17 h2. The easy way
18
19 For your convenience, the "api client authorizations" page on Workbench provides a "Help" tab that provides a command you may copy and paste directly into the shell.  It will look something like this:
20
21 bc. ### Pasting the following lines at a shell prompt will allow Arvados SDKs
22 ### to authenticate to your account, youraddress@example.com
23 read ARVADOS_API_TOKEN <<EOF
24 2jv9346o396exampledonotuseexampledonotuseexes7j1ld
25 EOF
26 export ARVADOS_API_TOKEN ARVADOS_API_HOST={{ site.arvados_api_host }}
27
28 * The @read@ command takes the contents of stdin and puts it into the shell variable named on the command line.
29 * The @<<EOF@ notation means read each line on stdin and pipe it to the command, terminating on reading the line @EOF@.
30 * The @export@ command puts a local shell variable into the environment that will be inherited by child processes (e.g. the @arv@ client).
31
32 h2. Setting the environment manually
33
34 Alternately, look for the column *api_token* contains the actual token string that you will use.  Copy the value of *api_token* for the first row onto the clipboard.
35
36 <notextile>
37 <pre><code>$ <span class="userinput">export ARVADOS_API_HOST={{ site.arvados_api_host }}</span>
38 $ <span class="userinput">export ARVADOS_API_TOKEN=2jv9346o3966345u7ueuim7a1zaaoueo3w90tzq3gx0es7j1ld</span>
39 </code></pre>
40 </notextile>
41
42 * @ARVADOS_API_HOST@ tells @arv@ which host to connect to
43 * @ARVADOS_API_TOKEN@ is the secret key used by the Arvados API server to authenticate access.
44
45 If you are connecting to a development instance with a unverified/self-signed SSL certificate, set this variable to skip SSL validation:
46
47 <notextile>
48 <pre><code>$ <span class="userinput">export ARVADOS_API_HOST_INSECURE=1
49 </code></pre>
50 </notextile>
51
52 h2. settings.conf
53
54 Arvados tools will also look for the authentication information in @~/.config/arvados/settings.conf@. If you have already put the variables into the environment with instructions above, you can use these commands to create an Arvados configuration file:
55
56 <notextile>
57 <pre><code>$ <span class="userinput">echo "ARVADOS_API_HOST=$ARVADOS_API_HOST" > ~/.config/arvados/settings.conf</span>
58 $ <span class="userinput">echo "ARVADOS_API_TOKEN=$ARVADOS_API_TOKEN" >> ~/.config/arvados/settings.conf</span>
59 </code></pre>
60 </notextile>
61
62 h2. .bashrc
63
64 Alternately, you may add the declarations of @ARVADOS_API_HOST@ and @ARVADOS_API_TOKEN@ to the @~/.bashrc@ file on the system on which you intend to use the Arvados client.  If you have already put the variables into the environment with instructions above, you can use these commands to append the environment variables to your @~/.bashrc@:
65
66 <notextile>
67 <pre><code>$ <span class="userinput">echo "export ARVADOS_API_HOST=$ARVADOS_API_HOST" >> ~/.bashrc</span>
68 $ <span class="userinput">echo "export ARVADOS_API_TOKEN=$ARVADOS_API_TOKEN" >> ~/.bashrc</span>
69 </code></pre>
70 </notextile>