From 11deb60267ff497ea3cc27667fcaefef329f47a8 Mon Sep 17 00:00:00 2001 From: dacongda Date: Sun, 18 Aug 2024 22:47:30 +0800 Subject: [PATCH] fix: move to public-api --- docs/basic/public-api.md | 9 ++++++++- docs/user/api-key.md | 21 -------------------- sidebars.js | 1 - static/img/{user => basic}/user_api_key.png | Bin 4 files changed, 8 insertions(+), 23 deletions(-) delete mode 100644 docs/user/api-key.md rename static/img/{user => basic}/user_api_key.png (100%) diff --git a/docs/basic/public-api.md b/docs/basic/public-api.md index 668fcb811..65bafe4bc 100644 --- a/docs/basic/public-api.md +++ b/docs/basic/public-api.md @@ -87,7 +87,8 @@ The below examples shows how to call `GetOAuthToken()` function in Go via casdoo #### How to authenticate? -1. HTTP `GET` parameter, the URL format is: +1. Create a pair of accessKey and accessSecret in account setting page. +2. HTTP `GET` parameter, the URL format is: ```shell /page?clientId=&clientSecret= @@ -95,6 +96,12 @@ The below examples shows how to call `GetOAuthToken()` function in Go via casdoo Demo site example: `https://door.casdoor.com/api/get-global-providers?clientId=294b09fbc17f95daf2fe&clientSecret=dd8982f7046ccba1bbd7851d5c1ece4e52bf039d` +![User Api Key](/img/basic/user_api_key.png) + +```bash +curl --location 'http://door.casdoor.com/api/user?accessKey=b86db9dc-6bd7-4997-935c-af480dd2c796&accessSecret=79911517-fc36-4093-b115-65a9741f6b14' +``` + 2. [HTTP Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication), the HTTP header format is: ```shell diff --git a/docs/user/api-key.md b/docs/user/api-key.md deleted file mode 100644 index ef07c1afb..000000000 --- a/docs/user/api-key.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: Api Key -description: Access api with api key -keywords: [user, api key, accessKey, accessSecret] -authors: [DacongDA] ---- - -## Access api with api key - -You can access casdoor api with accessKey and accessSecret of user. - -1. Create a pair of accessKey and accessSecret in account setting page. -2. Put accessKey and accessSercet in into the http query param. - -## Example - -![User Api Key](/img/user/user_api_key.png) - -```bash -curl --location 'http://door.casdoor.com/api/user?accessKey=b86db9dc-6bd7-4997-935c-af480dd2c796&accessSecret=79911517-fc36-4093-b115-65a9741f6b14' -``` diff --git a/sidebars.js b/sidebars.js index 5d28a39d2..a4a19971a 100644 --- a/sidebars.js +++ b/sidebars.js @@ -332,7 +332,6 @@ module.exports = { "user/multi-factor-authentication", "user/roles", "user/permissions", - "user/api-key", ], }, { diff --git a/static/img/user/user_api_key.png b/static/img/basic/user_api_key.png similarity index 100% rename from static/img/user/user_api_key.png rename to static/img/basic/user_api_key.png