Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added variables for accessing tokens and refreshToken #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions requests.rest
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
GET http://localhost:3000/posts
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSmltIiwiaWF0IjoxNTY4NzU5ODEyLCJleHAiOjE1Njg3NTk4Mjd9.0i6Im2gKz7jj8wM7aZZzOPaBS_xHoZWAqBwnldn-lQQ

###
# @name loginLink

DELETE http://localhost:4000/logout
POST http://localhost:4000/login
Content-Type: application/json

{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSmltIiwiaWF0IjoxNTY4NzU5OTIyfQ.RT6wszuCeFLwC_6ksmNMIELxiC5s-uRivfRxyZof5ag"
"username": "Jim"
}

###

@refreshToken = {{loginLink.response.body.$.refreshToken}}

# @name tokenLink

POST http://localhost:4000/token
Content-Type: application/json

{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSmltIiwiaWF0IjoxNTY4NzU5OTIyfQ.RT6wszuCeFLwC_6ksmNMIELxiC5s-uRivfRxyZof5ag"
"token": "{{refreshToken}}"
}

###

POST http://localhost:4000/login
@token = {{tokenLink.response.body.$.accessToken}}

# @name = posts

GET http://localhost:3000/posts
Authorization: Bearer {{token}}

###

DELETE http://localhost:4000/logout
Content-Type: application/json

{
"username": "Jim"
}
"token": "{{refreshToken}}"
}