Skip to content

Commit 2f9e889

Browse files
authored
πŸ’‚ Add better description for authentication. (#275)
* πŸ’‚ Add better description for authentication. * caps page metadata.
1 parent 0c52d22 commit 2f9e889

File tree

1 file changed

+43
-19
lines changed

1 file changed

+43
-19
lines changed

β€Žapi-playground/mdx/authentication.mdxβ€Ž

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ You can add an authentication method to your mint.json to enable it on every pag
99

1010
The page's authentication method will override mint.json if both are set.
1111

12+
### Bearer Token
13+
1214
<CodeGroup>
1315

1416
```json mint.json
@@ -19,7 +21,7 @@ The page's authentication method will override mint.json if both are set.
1921
}
2022
```
2123

22-
```md page metadata
24+
```md Page Metadata
2325
---
2426
title: "Your page title"
2527
authMethod: "bearer"
@@ -28,36 +30,58 @@ authMethod: "bearer"
2830

2931
</CodeGroup>
3032

31-
## Supported Authentication Methods
32-
33-
- bearer
34-
- basic
35-
- none
36-
37-
The "none" authentication method is useful to disable authentication on a specific endpoint after setting a default in mint.json.
38-
39-
## Authentication Name
33+
### Basic Authentication
4034

41-
By default, basic authentication asks for username and password. However, basic authentication can use a different name for username and password. For example, you could have called it `user-id:user-key`.
42-
43-
You can set the name property in mint.json to override the default functionality. Use colons to separate each property you want to request.
35+
<CodeGroup>
4436

45-
```json Custom username and password
37+
```json mint.json
4638
"api": {
4739
"auth": {
48-
"method": "basic",
49-
"name": "user-id:user-key"
40+
"method": "basic"
5041
}
5142
}
5243
```
5344

54-
You can also request a single API key by excluding the colon.
45+
```md Page Metadata
46+
---
47+
title: "Your page title"
48+
authMethod: "basic"
49+
---
50+
```
51+
52+
</CodeGroup>
5553

56-
```json Custom username and password
54+
### API Key
55+
56+
<CodeGroup>
57+
58+
```json mint.json
5759
"api": {
5860
"auth": {
5961
"method": "key",
60-
"name": "my-api-key"
62+
"name": "x-api-key"
6163
}
6264
}
6365
```
66+
67+
```md Page Metadata
68+
---
69+
title: "Your page title"
70+
authMethod: "key"
71+
---
72+
```
73+
74+
</CodeGroup>
75+
76+
### None
77+
78+
The "none" authentication method is useful to disable authentication on a specific endpoint after setting a default in mint.json.
79+
80+
<CodeGroup>
81+
```md Page Metadata
82+
---
83+
title: "Your page title"
84+
authMethod: "none"
85+
---
86+
```
87+
</CodeGroup>

0 commit comments

Comments
Β (0)