Building connect app -- Bearer token returns id: 0

Hi there!

Running into an issue where my bearer token is getting returned as 0. I’m pretty new at the Atlassian software development, so I’m hoping someone could help clarify a few things for me:

  1. Is it possible for me to pass a Bearer token (using user impersonation) as the authorization header for the /rest/api/3/webhook endpoint?
  2. Is it okay that I created a new OAuth credential in the app management area, and am using this to generate my Bearer token? I’m not looking to create a Jira plug-in or add-on, just an app (i.e. the bare minimum amount of setup necessary on the Jira side for users to run my app)
  3. I’m also using the node package for oauth2 found here, could this be why I’m not getting a bearer token?

Here is my printing of my bearer token id:
image

My scopes togged are “read,” “write,” “act_as_user.”

Thank you so much!
-Helen

@Helen welcome to the Atlassian developer community. Apologies for the multiple OAuth implementations around Jira (I’m counting 4 so far), which is surely the cause of your confusion.

If you use OAuth 2 3LO, then you are not using Atlassian Connect, which uses a different OAuth implementation. So if you are managing your credentials through the developer console (what I think you mean by the app management area), then you cannot use /rest/api/3/webhooks/. As stated in the API docs:

Permissions required: Only Connect apps can use this operation.

There is still an older /rest/webhooks/1.0/webhook that will accept an API token. You can find it at the bottom of the documentation on Jira Cloud webhooks in other integrations. You won’t be able to impersonate another user.

Hi @ibuchanan,

Thanks for getting back to me! So I was actually hoping to utilize 2LO user impersonation, which utilizes a bearer token right?

I thought that this was possible for Connect apps given this documentation here.

However, thank you for the heads up about the other endpoint! When you say it will accept an API token, do you mean basic auth?

Thank you~

Hi @ibuchanan!

So I got it working, however now I’m seeing a 404 error message when I’m receiving the Webhook data from Jira.

For context I’m using an ngrok server to test, so I’m able to see the payload, however the URL I provided for the webhook seems to be returning a 404?

Do you know why this may be the case?

Thank you!
-Helen

@Helen,

I’m glad you are making progress. I’m still confused about how your App works.

I think ngrok can show you a request, even if it fails. Hence, it is reaching the right host, but not the right path. It’s hard to offer more advice for your situation since I know so little about your context.