Created
March 2, 2018 10:19
-
-
Save mertkahyaoglu/403cd76c6e405963f9f5b85a109dffae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jwtTimeout = pm.environment.get("jwtTimeout") || 0; | |
if(new Date().getTime() > jwtTimeout) { | |
pm.sendRequest({ | |
url: pm.environment.get("baseUrl") + '/api/v1/merchants/login', | |
method: 'POST', | |
header: { | |
'content-type': 'application/json', | |
}, | |
body: { | |
mode: 'raw', | |
raw: JSON.stringify({ | |
"email": "", | |
"secretWord": "", | |
"reCaptchaResponse": "captcha123" | |
}) | |
} | |
}, function (err, res) { | |
pm.environment.set("jwtToken", "Bearer " + res.json().data.accessToken); | |
pm.environment.set("jwtTimeout", new Date().getTime() + 250000); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment