Skip to content

Postman pre-request script to fetch a token from Keycloak and set it to a collection variable to use in request headers.

License

Notifications You must be signed in to change notification settings

nimeshgit/keycloak-postman-pre-request

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Postman pre-request script for authentication with Keycloak

This is javascript for use with Postman's pre-request script feature. It makes POST request to Keycloak Token Endpoint to get a valid token and automatically set the token for all requests in Postman collection.

Usage

  1. Click edit on a collection and copy the content of keycloak-fetch-token-postman-pre-request.js into the "Pre-request Script" tab in Postman.

Edit collection

  1. In the Authorization tab set the Type to Bearer Token and Token to {{token}}. This is the token we created and set via the pre-request script.

Edit collection

  1. For all API requests: In the Authorization tab select Type - Inherit auth from parent
  2. ENJOY

About

Postman pre-request script to fetch a token from Keycloak and set it to a collection variable to use in request headers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%