Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot use "access_token" from my webhook response

Terry Dance
Contributor
September 19, 2024

My webhook successfully gets a token back, but I cannot use it any anything as Jira just fails to grab it. I've tried putting it into a variable, a comment or directly into the next webhook but its always blank.

My response is this;

 

Response

200OK
Headers (6)

Content-Type: application/vnd.appd.cntrl+json;v=1

x-content-type-options: nosniff

x-frame-options: SAMEORIGIN

x-xss-protection: 1; mode=block

Content-Length: 700

Connection: keep-alive

Payload
{
  "access_token": "xxx",
  "expires_in": 5
}

To access the token I've tried

 

{{webResponse.body.access_token}}

{{webhookResponse.body.access_token}}

{{webResponse.body.substringBetween("access_token\":", ",") }} - this works but leaves the " marks at beginning an end of the token, and trying to find the token between the 2 "'s doesnt work.

Anyone have an idea?

3 answers

1 accepted

0 votes
Answer accepted
Terry Dance
Contributor
September 19, 2024

Managed to create a "smart" variable with this

{{webhookresponse.body.substringBetween("access_token\": \"", "\",\"expires") }}

1 vote
marc -Collabello--Phase Locked-
Community Champion
September 19, 2024
0 votes
BryceD September 23, 2025

@Terry Dance if you use the {{webResponse.body.access_token}} smartvalue and then make sure you select the checkbox for the "Delay execution of subsequent rule actions until we've received a response for this web request" 

 

This will ensure you received the access token prior to trying to execute your next action.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events