You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following document explains how to authenticate with Run:ai APIs.
4
5
5
-
The following document explains how to authenticate with Run:ai APIs.
6
-
7
-
Run:ai APIs are accessed using _bearer tokens_. A token can be obtained in several ways:
6
+
Run:ai APIs are accessed using *bearer tokens*. A token can be obtained in several ways:
8
7
9
8
* When logging into the Run:ai user interface, you enter an email and password (or authenticated via single sign-on) which are used to obtain a token.
10
9
* When using the Run:ai command-line, you use a Kubernetes profile and are authenticated by pre-running `runai login` (or oc login with OpenShift). The command attaches a token to the profile and allows you access to Run:ai functionality.
11
-
* When using Run:ai APIs, you need to create an __Application__ through the Run:ai user interface. The Application is created with specific roles and contains a _secret_. Using the secret you can obtain a token and use it within subsequent API calls.
10
+
* When using Run:ai APIs, you need to create an **Application** through the Run:ai user interface. The Application is created with specific roles and contains a *secret*. Using the secret you can obtain a token and use it within subsequent API calls.
12
11
13
12
## Create a Client Application
14
13
15
14
* Open the Run:ai Run:ai User Interface.
16
-
* Go to `Settings | Application` and create a new Application.
17
-
* Set the required roles:
18
-
* Select `Researcher` to manipulate _Jobs_ using the [Cluster API](cluster-api/submit-rest.md). To provide access to a specific project, you will also need to go to `Application | Projects` and provide the Application with access to specific projects.
19
-
* Select `Editor` to manipulate _Projects_ and _Departments_ using the [Administrator REST API](admin-rest-api/overview.md).
20
-
* Select `Administrator` to manipulate _Users_, _Tenant Settings_ and _Clusters_ using the [Administrator REST API](admin-rest-api/overview.md).
21
-
* Copy the `<APPLICATION-NAME>` and `<CLIENT-SECRET>` to be used below
22
-
* Go to `Settings | General`, under `Researcher Authentication` copy `<REALM>`.
15
+
* Go to `Settings & Tools`, `Application` and create a new Application.
16
+
* Copy the `<APPLICATION>` and `<SECRET KEY>` to be used below
23
17
24
-
!!! Important Note
25
-
Creating Client Application tokens is only available with SaaS installations where the tenant has been created post-January 2022 or any Self-hosted installation. If you are an administrator but do not see the `Settings | Application` area, please contact Run:ai customer support.
18
+
### Access rules for the Application
19
+
20
+
* Set the required roles:
21
+
* Select `Researcher` to manipulate *Jobs* using the [Cluster API](cluster-api/submit-rest.md). To provide access to a specific project, you will also need to go to `Application | Projects` and provide the Application with access to specific projects.
22
+
* Select `Editor` to manipulate *Projects* and *Departments* using the [Administrator REST API](admin-rest-api/overview.md).
23
+
* Select `Administrator` to manipulate *Users*, *Tenant Settings* and *Clusters* using the [Administrator REST API](admin-rest-api/overview.md).
26
24
27
25
## Request an API Token
28
26
29
-
Use the above parameters to get a temporary token to access Run:ai as follows.
27
+
Use the above parameters to get a temporary token to access Run:ai as follows.
30
28
31
-
### Example command to get an API token
29
+
### Example command to get an API token
32
30
33
-
Replace `<COMPANY-URL>` below with `app.run.ai` for SaaS installations (not `<company>.run.ai`) or the Run:ai user interface URL for Self-hosted installations.
31
+
Replace `<COMPANY-URL>` below with:
32
+
33
+
* For SaaS installations use `<company>.run.ai`
34
+
* For self-hosted use the Run:ai user interface URL.
34
35
35
36
=== "cURL"
36
37
``` bash
37
-
curl -X POST 'https://<COMPANY-URL>/auth/realms/<REALM>/protocol/openid-connect/token' \
@@ -78,19 +70,11 @@ The API response will look as follows:
78
70
79
71
```JSON title="API Response"
80
72
{
81
-
"access_token": "...", // (1)
82
-
"expires_in": 36000,
83
-
....
84
-
"token_type": "bearer"
85
-
"id_token": "..."
73
+
"accessToken": "<TOKEN>",
86
74
}
87
75
```
88
76
89
-
1. Use the `id_token` as the Bearer token below.
90
-
91
-
92
-
To call APIs, the application must pass the retrieved `access_token` as a Bearer token in the Authorization header of your HTTP request.
93
-
94
-
* To retrieve and manipulate Workloads, use the [Cluster API](cluster-api/workload-overview-dev.md). Researcher API works at the cluster level and you will have different endpoints for different clusters.
95
-
* To retrieve and manipulate other metadata objects, use the [Administrator REST API](admin-rest-api/overview.md). Administrator API works at the control-plane level and you have a single endpoint for all clusters.
77
+
To call APIs, the application must pass the retrieved `accessToken` as a *Bearer token* in the Authorization header of your HTTP request.
96
78
79
+
* To retrieve and manipulate Workloads, use the [Cluster API](cluster-api/workload-overview-dev.md). Researcher API works at the cluster level and you will have different endpoints for different clusters.
80
+
* To retrieve and manipulate other metadata objects, use the [Administrator REST API](admin-rest-api/overview.md). Administrator API works at the control-plane level and you have a single endpoint for all clusters.
0 commit comments