API returns 401 with access token obtained using OAuth 2.0 private integration

We are using https://<OUR_DOMAIN>.atlassian.net/rest/api/3/users/search API to get users in our Jira account.

We have configured OAuth 2.0 Integration at https://developer.atlassian.com/console/myapps/

We have prod/dev configs as only one callback URL is allowed per OAuth 2.0 instance.

But we get 401 Unauthorized when we call users API, using access token obtained using one of the above instances.

Both the instances are configured ( i.e. scopes, permissions ) exactly the same except their callback URL which is prod/dev specific.

The working OAuth 2.0 instance gives the correct access token for users API, If we change the callback URL as per the environment.

But the other buggy OAuth 2.0 instance with exact same configs, fails with 401 Unauthorized.

We are using the following scopes:

read:jira-user manage:jira-configuration offline_access

User & Workspace are the same while giving consent during the OAuth flow.

What may be the cause of this?

1 Like

Hi @PrashantJagadale,

To resolve the problem, please perform the API request using the “api.atlassian.com” URL format described in OAuth 2.0 (3LO) apps instead of the one currently being used, which is the “your_domain.atlassian.net”.

Cheers,
Guilherme Bueno

2 Likes