# 授權認證

處理使用者身份的驗證及授權，包括：取得 access token、更新 access token。

## 登入

> \`\`\`\
> \`\`\`<br>

````json
{"openapi":"3.0.0","tags":[{"name":"授權認證","description":"處理使用者身份的驗證及授權，包括：取得 access token、更新 access token。"}],"servers":[{"url":"https://104demotest-api-server.hrmax.104.com.tw"}],"paths":{"/api/auth/signIn":{"post":{"tags":["授權認證"],"summary":"登入","description":"```\n```\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["account","password"],"properties":{"account":{"type":"string"},"password":{"type":"string"}}}}}},"responses":{"200":{"description":"登入成功\n```\n{\n  code: 200,\n  data: {\n    USER_ID: number,\n    REFRESH_TOKEN: string,\n    ACCESS_TOKEN: string,\n  },\n}\n```\n"},"440":{"$ref":"#/components/responses/440"},"490":{"description":"登入失敗\n```\n{\n  code: 490,\n  msg: string,   // 失敗原因\n}\n```\n"},"500":{"$ref":"#/components/responses/500"}}}}},"components":{"responses":{"440":{"description":"參數錯誤 (請檢查 parameters 或 request body 的欄位、格式是否完整及正確)"},"500":{"description":"系統異常 `{ code: 500, msg: string }`"}}}}
````

## POST /api/auth/signOut

> 登出

```json
{"openapi":"3.0.0","tags":[{"name":"授權認證","description":"處理使用者身份的驗證及授權，包括：取得 access token、更新 access token。"}],"servers":[{"url":"https://104demotest-api-server.hrmax.104.com.tw"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"responses":{"401":{"description":"認證失敗 (請更新 accessToken 再試一次)"},"440":{"description":"參數錯誤 (請檢查 parameters 或 request body 的欄位、格式是否完整及正確)"},"500":{"description":"系統異常 `{ code: 500, msg: string }`"}}},"paths":{"/api/auth/signOut":{"post":{"tags":["授權認證"],"summary":"登出","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["REFRESH_TOKEN"],"properties":{"REFRESH_TOKEN":{"type":"string","description":"refresh token"}}}}}},"responses":{"200":{"description":"成功登出"},"401":{"$ref":"#/components/responses/401"},"440":{"$ref":"#/components/responses/440"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## POST /api/auth/token/refresh

> 更新access token

````json
{"openapi":"3.0.0","tags":[{"name":"授權認證","description":"處理使用者身份的驗證及授權，包括：取得 access token、更新 access token。"}],"servers":[{"url":"https://104demotest-api-server.hrmax.104.com.tw"}],"paths":{"/api/auth/token/refresh":{"post":{"tags":["授權認證"],"summary":"更新access token","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["REFRESH_TOKEN"],"properties":{"REFRESH_TOKEN":{"type":"string","description":"refresh token"}}}}}},"responses":{"200":{"description":"更新成功\n```\n{\n  code: 200,\n  access: string, // 新的 access token\n}\n```\n"},"440":{"$ref":"#/components/responses/440"},"490":{"description":"驗證失敗 `{ code: 490, msg: string }`"},"500":{"$ref":"#/components/responses/500"}}}}},"components":{"responses":{"440":{"description":"參數錯誤 (請檢查 parameters 或 request body 的欄位、格式是否完整及正確)"},"500":{"description":"系統異常 `{ code: 500, msg: string }`"}}}}
````


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://104ha-docs.gitbook.io/104-ha-openapi/clients/104-hr-max/shou-quan-ren-zheng.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
