-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Use a URL that contains a JSON token value and set that dynamically per-request
pm.sendRequest({
url: ['http://', pm.collectionVariables.get("baseUrl"), '/sanctum/csrf-cookie'].join(''),
method: 'GET'
}, function (error, response, { cookies }) {
if (!error && cookies) {
pm.environment.set('xsrfToken', cookies.get('XSRF-TOKEN'))
pm.sendRequest({
url: ['http://', pm.collectionVariables.get("baseUrl"), '/token.json'].join(''),
method: 'GET'
}, function (error, response) {
if (!error && response) {
try {
pm.collectionVariables.set('authToken', response.json().token)
} catch (err) {
console.error(err);
}
}
})
}
})Metadata
Metadata
Assignees
Labels
No labels