From 1b3bf3bd9baa1262bbe06eb645bc807c70e08064 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 14 Apr 2022 20:03:48 +0800 Subject: [PATCH] docs: api tokens Signed-off-by: Wing-Kam Wong --- .../en/developer-resources/accessing-apis.md | 33 +++++++++++++---- .../en/developer-resources/api-tokens.md | 36 ------------------- .../content/en/developer-resources/sdk.md | 2 +- 3 files changed, 28 insertions(+), 43 deletions(-) delete mode 100644 packages/noco-docs/content/en/developer-resources/api-tokens.md diff --git a/packages/noco-docs/content/en/developer-resources/accessing-apis.md b/packages/noco-docs/content/en/developer-resources/accessing-apis.md index 535e0ee79c..fc00a3716a 100644 --- a/packages/noco-docs/content/en/developer-resources/accessing-apis.md +++ b/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`. - -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. - +- 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) \ No newline at end of file +![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) \ No newline at end of file diff --git a/packages/noco-docs/content/en/developer-resources/api-tokens.md b/packages/noco-docs/content/en/developer-resources/api-tokens.md deleted file mode 100644 index 3e2777379c..0000000000 --- a/packages/noco-docs/content/en/developer-resources/api-tokens.md +++ /dev/null @@ -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. - - -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. - - -### 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) \ No newline at end of file diff --git a/packages/noco-docs/content/en/developer-resources/sdk.md b/packages/noco-docs/content/en/developer-resources/sdk.md index 2e3246ff24..90296ee001 100644 --- a/packages/noco-docs/content/en/developer-resources/sdk.md +++ b/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. -Note: The NocoDB SDK requires API token for authorization. If you haven't created an API token, please check out API Tokens and create one first. +Note: The NocoDB SDK requires API token for authorization. If you haven't created an API token, please check out API Tokens and create one first. ### SDK For Javascript