Forums

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

How can i authenticate for email api

Sisong
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!
November 22, 2021

The email api doc suggests the basic authentication way to access the api using email and api-key.

But how could i use the app key "internal-email-api-developermode" and shared secret to authenticate for this api? 

I've tried using python JIRA library to start the session and used session cookies for this email api but it returns 401 saying:

{"message":"Client must be authenticated to access this resource.","status-code":401}

Please help. Thanks!

1 answer

0 votes
Derek White
Contributor
November 22, 2021

Following the curl example on the linked email api doc page, they go in the --user flag, which is curl's basic auth syntax.

Basic auth involves setting the "Authorization" header to a specific value. For Basic auth that value is "Basic " (notice the space) concatenated with the base64 of username, ":", and password (as shown in the curl example).

This email api doesn't use username and password, it uses email and api key; so, use those in place.

In java it would be similar to:

headers.put("Authorization", "Basic " + Base64.getEncoder().encode(email + ":" + apiKey))

https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#basic_authentication_scheme

Andrey Vyrvich
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!
February 5, 2025

@Derek White but how to get email to auth this request? In fact the only goal for me is to get current user email - I tried AP.getUser() or 

AP.request('/rest/api/2/myself') but both of them omit email

Suggest an answer

Log in or Sign up to answer