Created
June 4, 2024 22:15
-
-
Save waquwex/40111cd67b120b87819d44c20ccdaa4f to your computer and use it in GitHub Desktop.
.http Get Bearer token from response body and use it in another authenticated request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Tested with VS CODE Rest Client extension | |
| ## First trigger getToken request, it will use data from getToken response body in specified requests. | |
| ### Get Token for "bob" | |
| # @name getToken | |
| POST http://localhost:5001/connect/token | |
| Content-Type: application/x-www-form-urlencoded | |
| client_id=rest_tester | |
| &client_secret=secret123 | |
| &grant_type=password | |
| &username=bob | |
| &password=Pass123$ | |
| &scope=auctionApp openid profile | |
| ### Create Auction with Access Token | |
| # @name createAuction | |
| POST http://localhost:6001/auctions | |
| Content-Type: application/json | |
| Authorization: Bearer {{getToken.response.body.access_token}} | |
| { | |
| "make": "TAMA", | |
| "model": "TAMA", | |
| "year": "1947", | |
| "color": "White", | |
| "mileage": "123123", | |
| "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/1/19/Tama-denki-jidosya01.jpg", | |
| "reservePrice": "150000", | |
| "auctionEnd": "2024-06-12T00:00Z" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment