I am developing a plugin for JIRA cloud, and have to get unique id for the user across installations.
JiraAuthenticationContext authContext = ComponentAccessor.getJiraAuthenticationContext();
ApplicationUser loggedInUser = authContext.getLoggedInUser();
loggerInUser.getId(); //10000
For me loggerInUser.getId() returns 10000. So can there be a case where it returns the same id(i.e 10000) for different user in a different team, different project ??
If yes, what is the best way to uniquely identify a user?
So, you are that I should not worry about creating unique key. I can just use ACCESS_TOKEN_{jiraUser.getId()} as key since for other user with same id it will be separate instance, separate environment. So it is not gonna collide. Right?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am writing a plugin which appears as web panel in right bar of issue page. First of all user will be doing oauth will some third party app. Then I am storing access tokens(which came via oauth) using PluginSettingsFactory, which stores data in key-value format. I want to store access tokens with some unique key like ACCESS_TOKEN_{UserId} which I am struggling to create.
Once oauth is done, I would be asking user for select some configuration which will come as form on issue page's right bar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You don't need some form of botched incorrect uniqueness for that, you don't actually care where else the account has been used, and you're not vulnerable to attack because it's a separate application.
I don't understand what you think you need here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So, you are saying that I should not worry about creating unique key. I can just use ACCESS_TOKEN_{jiraUser.getId()} as key since for other user with same id it will be separate instance, separate environment. So it is not gonna collide. Right?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Correct, it's not needed because they're separate.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The id is unique across teams and projects. It is unique within a JIRA installation but you might find the same id if you are querying a different instance of JIRA.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jobin Kuruvilla [Adaptavist] Thanks for answering.
what do you mean by "a different instance of JIRA"?
Do two JIRA installations on JIRA Cloud mean two instances?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There are hundreds of thousands of different, separate servers out there running Jira instances. On some of them, I log in as nbrough. In a couple of them, that will be user 10000. In most of them, it won't be, I will have a different ID for my account.
Cloud is slightly different - it uses Atlassian accounts. My Atlassian account lets me access around 30 of them. Although I am only using one Atlassian account, the ID you'll find for it will vary across all of them
So, yes, "two Cloud installations are two instances", and "no, you cannot assume that user 10000 on instance 1 is the same account as 10000 on instance 2". You will need to be looking at the whole account, matching it on the Atlassian ID (email is probably the best proxy for that)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nic Brough -Adaptavist- Thanks for the clarity.
With email too, we'll not be able to uniquely identify a user. user might be registered to two instances with same email.
I need to create an identifier for user across instances.
If some how I can get instance id, instanceid.concat(userId) can be used as indentifier. I am not sure if there is a way to get instance id.
Please let me know if you have some way of creating an identifier for user across instances.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't understand your comment about email. If a user is registered on two different Jira instances with the same email, then they should be the same person, and hence unique. In fact, that's what Atlassian IDs do on cloud - you can only have one Atlassian account for an email address, and many Cloud systems use that one unique account. They'll have different IDs in the system, but the email is for one single unique user.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For me a user(with single email) on two instances are two different users.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, they're almost always going to be the same human (and absolutely should be the same user)
I think this takes us back to the actual requirement through. What are you actually trying to achieve and why? What use is it? What problem are you trying to solve?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.