Skip to content

Commit

Permalink
Fix up docs and http file for net8 identity framework (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekistler authored Mar 26, 2024
1 parent 2e54de3 commit abd9421
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ The Todo REST API can run standalone as well. You can run the [TodoApi](TodoApi)
Before executing any requests, you need to create a user and get an auth token.
1. To create a new user, run the application and POST a JSON payload to `/users` endpoint:
1. To create a new user, run the application and POST a JSON payload to `/users/register` endpoint:
```json
{
"username": "myuser",
"email": "myuser@contoso.com",
"password": "<put a password here>"
}
```
1. To get a token for the above user, hit the `/users/token` endpoint with the above user name and password. The response will look like this:
1. To get a token for the above user, hit the `/users/login` endpoint with the above user email and password. The response will look like this:
```json
{
Expand All @@ -120,7 +120,7 @@ Before executing any requests, you need to create a user and get an auth token.
}
```
1. You should be able to use this token to make authenticated requests to the todo endpoints.
1. You should be able to use the accessToken to make authenticated requests to the todo endpoints.
### Social authentication
Expand Down
22 changes: 13 additions & 9 deletions Requests/todo.http
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
@TodoApi_HostAddress = http://localhost:5000

### Create a user
@password = <put a password here>

POST http://localhost:5000/users
POST {{TodoApi_HostAddress}}/users/register
Content-Type: application/json

{
"username": "myuser",
"email": "myuser@contoso.com",
"password": "{{password}}"
}

### Get a token
### Log in to get a token

POST http://localhost:5000/users/token
POST {{TodoApi_HostAddress}}/users/login
Content-Type: application/json

{
"username": "myuser",
"email": "myuser@contoso.com",
"password": "{{password}}"
}

@token = <put JWT token here>
###

@token = <put accessToken (JWT) token here>

### Create a todo

POST http://localhost:5000/todos
POST {{TodoApi_HostAddress}}/todos
Authorization: Bearer {{token}}
Content-Type: application/json

Expand All @@ -33,9 +37,9 @@ Content-Type: application/json

### Get all todos

GET http://localhost:5000/todos
GET {{TodoApi_HostAddress}}/todos
Authorization: Bearer {{token}}

### Delete a todo
DELETE http://localhost:5000/todos/1
DELETE {{TodoApi_HostAddress}}/todos/1
Authorization: Bearer {{token}}

0 comments on commit abd9421

Please sign in to comment.