Hello,
I am trying using postman to store the “user-token” value in an Environment variable in order to chain requests.
Here is the body response of the login request:
{
“lastLogin”: 1674400047983,
“userStatus”: “ENABLED”,
“FirstName”: “Pierre”,
“created”: 1674400043700,
“accountType”: “BACKENDLESS”,
“ownerId”: “A05B94E7-C592-4558-8FF3-D78DC626A6EE”,
“socialAccount”: “BACKENDLESS”,
“oAuthIdentities”: null,
“___class”: “Users”,
“blUserLocale”: “en”,
“LastName”: “Dupont”,
“user-token”: “12C15B04-A910-4A9C-903B-9958A988C34B”,
“updated”: null,
“objectId”: “A05B94E7-C592-4558-8FF3-D78DC626A6EE”,
“email”: “tesr@example.com”
}
In the tests part of the postman editor, I wrote the following script:
var jsonData = JSON.parse(responseBody);
console.log("First name: "+jsonData.FirstName)
console.log(“Object ID :” +jsonData.objectId)
console.log(“User token :”+jsonData.user-token)
And I get the following output:
First name: Pierre
Object ID :A05B94E7-C592-4558-8FF3-D78DC626A6EE
ReferenceError: token is not defined
For some reasons, I can not retrieve the user-token value.
Please could you help me with this?
Best,
Armand