# 1.12.3.取得Token的方式

## 1.Introduction

* 取得審批資料, Log資料前必須先向server取得JWT token, 並附在request中驗證身分

## 2.透過Postman

* 1.下載並開啟[Postman](https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop/related?hl=zh-TW)
* 2.選擇方法為POST, 並填入正確的URL
* 3.在Body -> x-www-form-urlencoded
  * 填入兩個key: UserName, Password
  * Value

    則分別複製[UserName, Password的值 (此為private repo, 需先登入Github)](https://github.com/JenHsuan/Approved-Collection-Server/blob/master/DataCollectService/4.Documents/%E5%B8%B3%E8%99%9F%E5%AF%86%E7%A2%BC.com)
* 4.按下Send, 則可取得一個token
* 5.請注意: token的有效期限為20分鐘

![](/files/-M4M0WNWo2Ibhsab1jro)

## 3.透過API

* 請參考: <https://dotblogs.com.tw/wellwind/2016/11/24/jwt-auth-web-api>


---

# 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://jen-hsuan-hsieh.gitbook.io/asp-net/chapter1/1.1.the-complete-asp.net-mvc-5-course/112approved-collection-server/1122qu-de-token-de-fang-shi.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.
