Hi, I’m trying to use this script from adaptavist library: https://library.adaptavist.com/entity/create-a-tempo-account-using-the-rest-api
But the "credentials" variable appears to be null after the following code, so i cant make the Basic authentication:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.properties.APKeys
import groovyx.net.http.ContentType
import groovyx.net.http.EncoderRegistry
import groovyx.net.http.HttpResponseDecorator
import groovyx.net.http.RESTClient
final String userPropertyKey = "jira.meta.basicAuthCreds"
def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def credentials = ComponentAccessor.userPropertyManager.getPropertySet(loggedInUser).getString(userPropertyKey)
def baseUrl = ComponentAccessor.applicationProperties.getString(APKeys.JIRA_BASEURL)
Hello @rodolfocostapr,
I am part of the Library Project team. Please, do you mind creating this question in our portal https://productsupport.adaptavist.com/servicedesk/customer/portal/49/create/337? Thus, we can track this issue better. For me time being, it might be a silly answer, but have you created correctly "basicAuthCreds" as a Jira User Property?
Thank you very much.
Regards,
Miguel.
Hi @Miguel Ángel García Gómez , im not the admin for the instalation, but i will check with him. Can you give me a link to a tutorial with the instructions on how to create the "basicAuthCreds" User Property? I having a hard time finding one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @rodolfocostapr ,
Sure, I can share with you this script, also included in Library, where the user properties are used. And here is the link for the official documentation provided by Atlassian ("Add a property to a user" section), explaining how to manage these properties.
I hope this can help you.
Regards,
Miguel.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Miguel Ángel García Gómez , I have read the material e now I have a better understanding of the situation. But can u point out to me how the basicAuthCreds would be added to the User Property, I haven’t found how the password would be stored in there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @rodolfocostapr ,
As you can see in the description of the Library script, it can be added as:
API request credentials are stored as user properties. This property is named as basicAuthCreds
and it contains user and password in the following format: <user>:<password>
.
So it could be something like admin:admin
. But please, bear in mind changing it for a strongest password ;)
Regards,
Miguel.
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.