Authentication issue in Jira cloud Api(Not working with Bearer Token)

While using Basic auth as a parameter getting response 200 but while using Bearer token getting 400 response(API token is correct that we can get from cokkies that we are using as a bearer token)

//while using Bearer token points that we already did
1)Created a new Api token
2)Check with correct encoding in the code as well.
3)Getting same error in code as well

Thanks

Welcome to the Atlassian developer community @JatinKapoor,

It’s not clear to me to what you are referring. Can you hyperlink to the docs that explain the Bearer tokens you are using? I have a suspicion that you are trying to use the API Tokens for Bearer tokens; nowhere do the docs say that’s how they work. API Tokens only work with Basic auth.

Hi,
I used this code for sending get request


in the userName and Password I am passing username as mailid and password as the token but getting 400 bad request But in postman it is working fine.

@JatinKapoor,

What makes you think the problem is with auth? The 400 status is usually related to a bad URL or body in the request. In that code, it looks like you are putting the search path into the query string.