I have configured postman by forking the api from this link.
and went thru the steps for configuration. still getting the error when making the api call.
I have configured postman by forking the api from this link.
and went thru the steps for configuration. still getting the error when making the api call.
As you can see in the error message Pre-request script is not able to read your tenant (shown undefined
).
const domain = pm.environment.get('domain') ? pm.environment.get('domain') : pm.collectionVariables.get('domain')
const tokenUrl = 'https://' + pm.environment.get('tenant') + '.api.' + domain + '.com/oauth/token';
I would start with tracing pm.environment.get('tenant')
in the environmet variables. It could a simple error as tenant being misspelt
It’s very common for people to forget to define an environment… and more importantly, actually select the environment from the drop-down after creating it
I can see in the screenshot that your tenant is “undefined”. @mcheek is correct, in that you likely did not setup your postman environment correctly. Please follow this guide very closely.
In some cases, I get a an error saying
{
"error": "JWT validation failed: JWT is expired"
}
Not sure how I reach this point, but somewhere my “tokenExpTime” variable gets an empty value and I start seeing this error.
Once I just delete the “tokenExpTime” variable from environment and make another API call. The Pre-request scripts refreshes the token as expected.
Should we update the pre-request script to handle empty strings?
Does anyone else face this issue?
Try updating your collections to the latest version. I believe there was a fix for that at some point
Oh,
Thanks @mcheek , will update and check again. Been a while sine I updated the Postman collections.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.