Browse Source

docs: api tokens

Signed-off-by: Wing-Kam Wong <wingkwong.code@gmail.com>
pull/1685/head
Wing-Kam Wong 3 years ago
parent
commit
1b3bf3bd9b
  1. 33
      packages/noco-docs/content/en/developer-resources/accessing-apis.md
  2. 36
      packages/noco-docs/content/en/developer-resources/api-tokens.md
  3. 2
      packages/noco-docs/content/en/developer-resources/sdk.md

33
packages/noco-docs/content/en/developer-resources/accessing-apis.md

@ -6,13 +6,13 @@ category: 'Developer Resources'
menuTitle: 'Accessing APIs'
---
## REST APIs
NocoDB APIs can be authorized by either Auth Token or API Token.
- Go to NocoDB Project, click the rightmost button and click ``Copy Auth Token``.
## Auth Token
Auth Token is a JWT Token generated based on the logged-in user. By default, the token is only valid for 10 hours. However, you can change the value by defining it using environment variable `NC_JWT_EXPIRES_IN`. If you are passing Auth Token, make sure that the header is called `xc-auth`.
<alert>
Auth Token is a JWT Token generated based on the logged-in user. By default, the token is only valid for 10 hours. However, you can change the value by defining it using environment variable NC_JWT_EXPIRES_IN. If you are passing Auth Token, make sure that the header is called xc-auth.
</alert>
- Go to NocoDB Project, click the rightmost button and click ``Copy Auth Token``.
![image](https://user-images.githubusercontent.com/35857179/161957971-e4888983-25e1-46a4-8419-7b9fae6cb6fa.png)
@ -28,4 +28,25 @@ Auth Token is a JWT Token generated based on the logged-in user. By default, the
- Paste the token you just copy in step 1 and click Authorize
![image](https://user-images.githubusercontent.com/35857179/126188510-b3790348-6809-4182-911a-a4031ace2fd2.png)
![image](https://user-images.githubusercontent.com/35857179/126188510-b3790348-6809-4182-911a-a4031ace2fd2.png)
## API Token
NocoDB allows creating API tokens which allow it to be integrated seamlessly with 3rd party apps. API Token is a Nano ID with a length of 40. If you are passing API Token, make sure that the header is called `xc-token`.
- Go to `Team & Settings` from the left navigation drawer
![image](https://user-images.githubusercontent.com/35857179/161902474-fd06678c-a171-4237-b171-dc028b3753de.png)
- Click `API Tokens Management`
![image](https://user-images.githubusercontent.com/35857179/161958345-83cb60bf-80f1-4d11-9e9c-52d0b05c7677.png)
- Click Add New Token
![image](https://user-images.githubusercontent.com/35857179/161958563-dc5d380a-26c5-4b78-9d4b-e40188bef05a.png)
- Type an recognizable name for your token and click `Generate`
![image](https://user-images.githubusercontent.com/35857179/161958676-e4faa321-13ca-4b11-8d22-1332c522dde7.png)
- Copy API token to your clipboard
![image](https://user-images.githubusercontent.com/35857179/161958822-b0689a6a-a864-429f-8bb2-71eb92808339.png)

36
packages/noco-docs/content/en/developer-resources/api-tokens.md

@ -1,36 +0,0 @@
---
title: 'API Tokens'
description: 'API Tokens'
position: 1040
category: 'Developer Resources'
menuTitle: 'API Tokens'
---
## API Tokens
NocoDB allows creating API tokens which allow it to be integrated seamlessly with 3rd party apps.
<alert>
API Token is a Nano ID with a length of 40. If you are passing API Token, make sure that the header is called xc-token.
</alert>
### Which HTTP Header to use ?
- ```xc-token``` header should be set when invoking the NocoDB APIs with the token.
### How to create a token ?
1. Go to `Team & Settings` from the left navigation drawer
![image](https://user-images.githubusercontent.com/35857179/161902474-fd06678c-a171-4237-b171-dc028b3753de.png)
2. Click `API Tokens Management`
![image](https://user-images.githubusercontent.com/35857179/161958345-83cb60bf-80f1-4d11-9e9c-52d0b05c7677.png)
3. Click Add New Token
![image](https://user-images.githubusercontent.com/35857179/161958563-dc5d380a-26c5-4b78-9d4b-e40188bef05a.png)
4. Type an recognizable name for your token and click `Generate`
![image](https://user-images.githubusercontent.com/35857179/161958676-e4faa321-13ca-4b11-8d22-1332c522dde7.png)
5. Copy API token to your clipboard
![image](https://user-images.githubusercontent.com/35857179/161958822-b0689a6a-a864-429f-8bb2-71eb92808339.png)

2
packages/noco-docs/content/en/developer-resources/sdk.md

@ -9,7 +9,7 @@ menuTitle: 'NocoDB SDK'
We provide SDK for users to integrate with their applications. Currently only SDK for Javascript is supported.
<alert>
Note: The NocoDB SDK requires API token for authorization. If you haven't created an API token, please check out <a href="./api-tokens" target="_blank">API Tokens</a> and create one first.
Note: The NocoDB SDK requires API token for authorization. If you haven't created an API token, please check out <a href="./accessing-apis#api-token" target="_blank">API Tokens</a> and create one first.
</alert>
### SDK For Javascript

Loading…
Cancel
Save