Skip to content

Instantly share code, notes, and snippets.

@dbischof
dbischof / postman-oauth2-refresh-token.js
Last active November 14, 2018 20:48 — forked from harryi3t/postman-oauth2-refresh-token.js
This gist shows how using the pre-request script in Postman, a new Oauth-2 token can be obtained using the a refresh token
/**
** Inspired by: https://stackoverflow.com/a/52436395/1756953
** Modified from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1
**
** Postman as of Nov 2018 does not support auto-refreshing of Oauth-2 tokens.
** This is an exmaple on how in one can refresh their Oauth-2 tokens just using the pre-request scripts.
** Pre-requisites: You need to have a refresh token. You can use the Postman app to get one.
**
** Step 1: Create a Postman environment and set the following variables:
** tokenUrl