Skip to content

Commit 728fa26

Browse files
author
Hadi T
committed
updated a README file with a quick changes
1 parent 5b4c43a commit 728fa26

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

README.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
# OAuth 2.1 Password Grant Type in Golang
2-
![workflow](https://github.com/syniol/golang-oauth-password-grant/actions/workflows/makefile.yml/badge.svg)
2+
![workflow](https://github.com/syniol/golang-oauth2/actions/workflows/makefile.yml/badge.svg)
33

4-
Implementation of standard OAuth 2.1 for Password Grant type in Golang
5-
and its native HTTP server.
4+
Implementation of standard OAuth 2.1 for Password Grant type in Golang and its native HTTP server.
5+
6+
7+
## Healthcheck API
8+
```text
9+
GET oauth2/healthz HTTP/1.1
10+
Host: 127.0.0.1
11+
Content-Type: text/plain
12+
```
13+
14+
__Request:__
15+
```bash
16+
curl -k --location --request GET 'https://127.0.0.1/healthz'
17+
```
18+
19+
__Response:__
20+
Status code `200` (OK) and a simple body response `ok` indicates API is working and operational.
21+
```text
22+
ok
23+
```
624

725

826
## Clients API
27+
This endpoint is responsible for creating a new client/user to be inserted in database.
28+
929
```text
1030
POST oauth2/clients HTTP/1.1
1131
Host: 127.0.0.1
@@ -17,7 +37,7 @@ __Request:__
1737
curl -k --location --request POST 'https://127.0.0.1/oauth2/clients' \
1838
--header 'Content-Type: application/json' \
1939
--data-raw '{
20-
"username": "johndoe2",
40+
"username": "johndoe",
2141
"password": "johnspassword1"
2242
}'
2343
```
@@ -31,6 +51,8 @@ __Response:__
3151

3252

3353
## Token API
54+
After client registration you can create a token sending a `POST` request to this endpoint.
55+
3456
```text
3557
POST oauth2/token HTTP/1.1
3658
Host: 127.0.0.1
@@ -42,7 +64,7 @@ __Request:__
4264
curl -k --location --request POST 'https://127.0.0.1/oauth2/token' \
4365
--header 'Content-Type: application/x-www-form-urlencoded' \
4466
--data-urlencode 'grant_type=password' \
45-
--data-urlencode 'username=johndoe1' \
67+
--data-urlencode 'username=johndoe' \
4668
--data-urlencode 'password=johnspassword1'
4769
```
4870

0 commit comments

Comments
 (0)