Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 925b298

Browse files
mtojekmafredri
andauthored
docs: improve authentication page (#5567)
* docs: improve authentication page * Update docs/admin/automation.md Co-authored-by: Mathias Fredriksson <[email protected]> * Update docs/admin/automation.md Co-authored-by: Mathias Fredriksson <[email protected]> * Fix * Fix Co-authored-by: Mathias Fredriksson <[email protected]>
1 parent 91a4c2d commit 925b298

File tree

3 files changed

+31
-38
lines changed

3 files changed

+31
-38
lines changed

docs/admin/automation.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22

33
We recommend automating Coder deployments through the CLI. Examples include [updating templates via CI/CD pipelines](../templates/change-management.md).
44

5-
## Tokens
5+
## Authentication
66

7-
Long-lived tokens can be generated to perform actions on behalf of your user account:
8-
9-
```console
10-
coder tokens create
11-
```
7+
Coder uses authentication tokens to grant machine users access to the REST API. Follow the [Authentication](../api/authentication.md) page to learn how to generate long-lived tokens.
128

139
## CLI
1410

@@ -23,14 +19,13 @@ coder workspaces ls
2319

2420
## REST API
2521

26-
You can use tokens with the Coder's REST API using the `Coder-Session-Token` HTTP header.
22+
You can review the [API reference](../api/index.md) to find the necessary routes and payload. Alternatively, you can enable the [Swagger](https://swagger.io/) endpoint to read the documentation and do requests against the API:
2723

2824
```console
29-
curl 'https://dev.coder.com/api/v2/workspaces' \
30-
-H 'Coder-Session-Token: *****'
25+
coder server --swagger-enable
3126
```
3227

33-
> At this time, we do not publish an API reference. However, [codersdk](https://github.com/coder/coder/tree/main/codersdk) can be grepped to find the necessary routes and payloads.
28+
By default, the local Swagger endpoint is http://localhost:3000/swagger.
3429

3530
## Golang SDK
3631

docs/api/authentication.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
# Authentication
22

3-
- API Key (CoderSessionToken)
4-
- Parameter Name: **Coder-Session-Token**, in: header.
3+
Long-lived tokens can be generated to perform actions on behalf of your user account:
4+
5+
```console
6+
coder tokens create
7+
```
8+
9+
You can use tokens with the Coder's REST API using the `Coder-Session-Token` HTTP header.
10+
11+
```console
12+
curl 'http://coder-server:8080/api/v2/workspaces' \
13+
-H 'Coder-Session-Token: *****'
14+
```
Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
11
<!-- APIDOCGEN: BEGIN SECTION -->
2-
{{= data.tags.section }}# Authentication
3-
{{ for (var s in data.api.components.securitySchemes) { }}
4-
{{ var sd = data.api.components.securitySchemes[s]; }}
5-
{{? sd.type == 'apiKey' }}
6-
- API Key ({{=s}})
7-
- Parameter Name: **{{=sd.name}}**, in: {{=sd.in}}. {{=sd.description || ''}}
8-
{{?}}
9-
{{? sd.type == 'http'}}
10-
- HTTP Authentication, scheme: {{=sd.scheme}}{{? sd.description }}<br/>{{=sd.description}}{{?}}
11-
{{?}}
12-
{{? sd.type == 'oauth2'}}
13-
- oAuth2 authentication. {{=sd.description || ''}}
14-
{{ for (var f in sd.flows) { }}
15-
{{ var flow = sd.flows[f]; }}
16-
- Flow: {{=f}}
17-
{{? flow.authorizationUrl}} - Authorization URL = [{{=flow.authorizationUrl}}]({{=flow.authorizationUrl}}){{?}}
18-
{{? flow.tokenUrl}} - Token URL = [{{=flow.tokenUrl}}]({{=flow.tokenUrl}}){{?}}
19-
{{? flow.scopes && Object.keys(flow.scopes).length}}
20-
|Scope|Scope Description|
21-
|---|---|
22-
{{ for (var sc in flow.scopes) { }}|{{=sc}}|{{=data.utils.join(flow.scopes[sc])}}|
23-
{{ } /* of scopes */ }}
24-
{{?}}
25-
{{ } /* of flows */ }}
26-
{{?}}
27-
{{ } /* of securitySchemes */ }}
2+
# Authentication
3+
4+
Long-lived tokens can be generated to perform actions on behalf of your user account:
5+
6+
```console
7+
coder tokens create
8+
```
9+
10+
You can use tokens with the Coder's REST API using the `Coder-Session-Token` HTTP header.
11+
12+
```console
13+
curl 'http://coder-server:8080/api/v2/workspaces' \
14+
-H 'Coder-Session-Token: *****'
15+
```

0 commit comments

Comments
 (0)