How to add basic authentication to Jira Custom Rest API Plugin

Hi Atlassian Team,

We have developed a Jira custom Rest API plugin and we are able to access the end point without any issues. But we wanted to add basic authentication to this new end point.

The new api end point looks like below.
<Jira_URL>/rest/api/useradmin/1/users/{userKey}

Could you please let us know how to add the basic auth ?

Regards
Muzeeb Mohammed

Hi Muzeeb,

I guess you want to access JIRA on behalf of the user accessing your rest api, right?

I don’t think that asking for username/password by your api is good idea. I assume your rest api will be used by some other program, that would need to persist the password, which is bad.

You may add ACT_AS_USER scope to your add-on, and leverage of Atlassian Token authentication. Then you can give end-user secret key (JWT token) so that they can use it when talking to your API.

See https://developer.atlassian.com/static/connect/docs/latest/concepts/understanding-jwt.html for more information.

I’m planning to do this too, so would love to know if it works for you.

Thank you.

3 Likes

Thanks Much @azhdanov for your help. Sure, as suggested, i would explore adding JWT approach instead of basic auth.
Appreciate your help.

Regards
Muzeeb

Hi Muzeeb,

May I ask if it works for you, or have you found this approach not usable?

I’m concerned about expiration of the token. Or is it possible to issue own token and reuse authentication verification logic provided by atlassian-connect-express?

Would you mind sharing your experience so far?

Thank you.