Forums

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

401 Unauthorized when using Organization API token to get log

Ngan Tran
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!
September 7, 2023

Hi Atlassian Team,

I generated API Token, following this documentation Link

I used that token and the email which generated the token to get audit records, following this documentation Link

I used Python code, the same as documentation 

But it returned 401 Unauthorized error and a message "Client must be authenticated to access this resource."

Then I added Authorization to header of the request.

auth_key = base64.b64encode(b"email:pass").decode("ascii")

headers = { "Authorization": "Basic " + auth_key}

Or without encoding base64

headers = { "Authorization": "Basic " + token}

It still returned the same error.

I've already double checked the email and token. There is no mistake. 

Did I miss anything ? 

 

Thanks and best regards,

Ngan Tran.

1 answer

1 accepted

1 vote
Answer accepted
Joseph Chung Yin
Community Champion
September 7, 2023

@Ngan Tran -

Welcome to the community.  Please refer to the following reference links to assist your trouble shooting of your issue -

https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/

https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-basic-auth-and-cookie-based-auth/

Hope this helps.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Technology Applications Team

Viasat Inc.

Ngan Tran
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!
September 8, 2023

Thank you. It worked. 

It can only run with personal access token, not organization api token. 

 

Thanks and best regards,

Ngan Tran.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events