How to persist an OAuth2 token (or use a refresh token) in Postman collections?

Ok, first enter your OAUTH token URL, click on the Body tab, and fill out these POST parameters:
client_id, grant_type, username, password, override.

enter image description here

Then, click on the Test tab, enter this text and then press Send:

var data = JSON.parse(responseBody);
postman.setGlobalVariable("access_token", data.access_token);
postman.setGlobalVariable("refresh_token", data.refresh_token);

enter image description here

Then enter one of your application URLs, click on the Headers Tab, and enter a parameter Authorization with a value Bearer {{access_token}}. Then click on Send.

enter image description here

Voila!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)