Our connect app integration is listed in Jira app marketplace and it has “ACCESS_EMAIL_ADDRESSES” scope available.
Our goal is to fetch email of user who initiated app installation.
We tried to use
/rest/api/3/myself API call, but it returned not the real user info, but like a user of type “app” which is our integration.
Next idea was to use
/rest/api/3/user/email API call, but we need to pass
accountId for that. To be able to find
accountId, we wanted to iterate through all users via
/rest/api/3/users/search, but it’s not possible to use that API method via Connect App.
Any advice how we can achieve that goal? Or are we looking into completely wrong direction?
Hi @AliakseiVilenski ,
Welcome to the community!!
As you might be aware there are certain lifecycle events associated with a connect app. In your case, whenever any user is trying to install the app, there is a response body which contains a bunch of attributes. In this article, Lifecycle requests payload you can find there is a accountId key in the payload through which you can get the desired email but there is a condition that one should be logged in. Otherwise, I don’t think there is any other way to get the email of the user. Although, you can get the serverId or Jira URL of the instance.
Hope, this helps with your query.
For anybody facing the same issue, I found solution:
Real user accountId is equal to “sub” parameter in JWT came with “installed” Atlassian Connect event.