Forums

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

why are we receiving " 401 unauthorized" on registering Jira webhook with OAuth2.0 ?

Jaswanth Boyidi name November 11, 2021

we have followed the documentation for the implementation. but we are receiving 401 unauthorized even though right scopes and tokens are provided. please confirm whether webhook registration with OAuth2.0 is working or not? Please confirm this ASAP.
our request looks like this

curl --location --request POST 'https://XXXXX.atlassian.net/rest/api/2/webhook' \
--header 'Authorization: Bearer XXXXXXXXX' \
--header 'x-atlassian-force-account-id: true' \
--header 'Content-Type: application/json' \
--data-raw '{
   "webhooks": [
      {
         "jqlFilter""project = XXX",
         "events": ["jira:issue_created""jira:issue_updated"]
      }]
}'

1 answer

0 votes
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 11, 2021

Hi @Jaswanth Boyidi name , welcome to the Community!

It looks like the Authorization header is what's causing the problem. In the example above, a Bearer type token is used. Atlassian Cloud's authorization uses tokens generated from id.atlassian.com , but these tokens go in place of what would typically be the password in user/pass type authorization. So your example:

 

curl --location --request POST 'https://XXXXX.atlassian.net/rest/api/2/webhook' \

--header 'Authorization: Bearer XXXXXXXXX' \
would instead need to be:
curl --location --request POST 'https://XXXXX.atlassian.net/rest/api/2/webhook' \

--user 'email@example.com:<api_token>' \
where the email address is the actual email address of the account that created the API token at https://id.atlassian.com/manage/api-tokens , and the <api_token> is the token generated and copied from that page.
Cheers,
Daniel
Jaswanth Boyidi name November 11, 2021

Hi @Daniel Eads ,

so Isn't it possible to register webhooks with OAuth2.0(3LO) using Bearer <Accesstoken>, as using the email address and api_token will be Basic Auth. could you please confirm if it is possible with OAuth2.0(3LO) using Bearer <Accesstoken>. sorry in advance if I'm wrong.

ante
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 30, 2021

Hi @Jaswanth Boyidi name ,

 

Have you managed to find out how to solve your issue? I am having similar difficulties

ante
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 19, 2022

@Jaswanth Boyidi name , exactly what I was looking for. Thank you very much

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events