Skip to content

Instantly share code, notes, and snippets.

@elshanx
Created July 27, 2023 14:00
Show Gist options
  • Save elshanx/07c3315f988b6249d4974dacbb890eb5 to your computer and use it in GitHub Desktop.
Save elshanx/07c3315f988b6249d4974dacbb890eb5 to your computer and use it in GitHub Desktop.
[Postman] Store access token automatically on [register, login] routes
if (pm.response.code !== 200) {
return;
}
const response = pm.response.json(),
accessToken = response.data.token;
// Storing the access token in the environment to be used in other endpoints
pm.collectionVariables.set('accessToken', accessToken);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment