I was trying to get accountId as I used to get user.key and user.id in jira cloud app. But I don't see accountId is passing in the request/context param.
I tried to pass manually in atlassian connect descriptor but it didn't help:
- ?accountId={user.accountId}
- ?accountId={profileUser.accountId}
How can I get accountId in my application either through request or any other way?
Thanks
Masud
Hello,
Check out "Major changes to Jira Cloud REST APIs are coming to improve user privacy" it details the changes on the Key value under the section "Updates to APIs which accept user name or key as input"
Regards,
Earl
Thanks for your reply.
Please look at the following url is being called from jira cloud issue details page using iframe to our app:
https://<cloud-app-url>/public/html/<entity>?projectId=10000&issueId=10000&user_id=<user.id>&user_key=<user.key>&tz=America%2FLos_Angeles&loc=en-US&xdm_e=https%3A%2F%2F<subdomain>.atlassian.net&xdm_c=channel-<addon_key>__viewissue-<entity>&cp=&xdm_deprecated_addon_key_do_not_use=<addon_key>&lic=none&cv=1.223.0&jwt=<jwt_string>
When I decode the jwt_string I get the following structure:
{
"sub": "<user>",
"qsh": "query_string_hash",
"iss": "<some_issuer>",
"context": {
"user": {
"accountId": "<accountId>",
"displayName": "Display Name",
"userKey": "<userKey>",
"username": "<userName>"
}
},
"exp": 1542131473,
"iat": 1542130573
}
If you look at the context property, it has accountId, so we can use this accountId from cloud app. But my question is this context param is an optional parameter as the following documentation says.
https://developer.atlassian.com/cloud/jira/platform/understanding-jwt/
So If someone is trying to create JWT token and they don't pass context property is still valid JWT token and will pass authentication. But in that case we(app) won't have option to get accountId.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.