Hello,
I have a collection in which a folder has been created that retrieves tokens from OKTA and storesthem as a variable in the environment. This is done for 3 users, user A, user B and user C.
Process is in three steps, authentication, authorization and token:
The variable for user A is set properly however the variable for user B also contains user Aโs token.
Deleting cookies does not help. Removing the variable and creating it again makes no difference.
For all users this same code snippet is used ( only user is different )
var response = pm.response.json();
console.log(response)
pm.test('Getting tokens is successfull', function () {
pm.expect(response.access_token).exist.and.not.be.empty
pm.expect(response.id_token).exist.and.not.be.empty
})
pm.environment.set('USERA_ACCESS_TOKEN',response.access_token)
pm.environment.set('USERA_ID_TOKEN',response.id_token)
Any ideas?
Platform Details:
Postman for Mac : Version10.22.2
UI version : 10.22.2-ui-240112-1641
Desktop platform version: 10.22.0
Architecture : arm64
OS platform : OS X 23.2.0
Is there a separate request for fetching the access tokens for each users, or youโre doing that in one single request? Iโm guessing the flow is for each request โ authenticate user A โ authorize user A โ fetch user A token, then repeat for user B and C. Is there a loop anywhere in this flow?
Can you share how youโre storing the variables for each user?
There are seperate requests for each user containing three calls each : authentication, authorization en token. So user A is handled until token is fetched, Then userB and so on. Tokens are set in environment A with :
Hi @danny-dainton Thanx for the quick response . I added some console logs and used the atob function to break down the JWT and what i now notice is that the value of the JWT of the second user is the same value of the first user.
So the token fetch of the second user returns the same token as the first user, while the credentials are different . Looks like some caching to me. Dive in deeper tomorrow.
Thanx so far
Found the issue!
There is a secure cookie which confused things and keep active in all requests. I did some experiments with cleaning cookies via cookies.jar. First results had no effect but after adding *.postman.com to the allowlist :