Harsha Vardhan
Harsha Vardhan

Reputation: 9

Extracting token and parameterizing in another request

I get a JSON response from a Post request

{
    "access_token": ".u9H5YgCCoMJHTW6SgVMxJe2aUEGHpMBbUf1456Gkj28",
    "token_type": "bearer",
    "expires_in": "4319",
    "scope": "READ "
}

I want to take this access token and pass it in another GET API request as the following.

And header Authorization = token

what i did ? first post api

* def response.access_token = token 
Given url ''
And header Authorization = token 

This is not working

Upvotes: 1

Views: 117

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58088

I think you got confused with the syntax, both the below will work:

And header Authorization = response.access_token

or:

* def token = response.access_token
And header Authorization = token

Upvotes: 1

Related Questions