I have a script variable that stores a refresh token for an Oauth2.0 authentication which I use to request access tokens from a script listener. However I would like to automate the process of resetting this script variable when the token expires. Is this possible, or else, is there another way I can store this where it can be updated from a script?
Hi Tyler,
I can confirm that it is not possible to programatically clear or set the values of Script Variables inside of Jira Cloud using ScriptRunner for Jira Cloud as Atlassian do not provide the API's to achieve this functionality.
Script Variables are designed to store items which can be shared acrross scripts and can only be updated on the Script Variables page as described here.
I can also confirm that there is no other way to store a global variable inside of Jira cloud as Atlassian do not provide any access to the file system on Jira Cloud.
You can see more detailed information on the API's between Jira Cloud and Jira Server in the documentation page located here.
If this response has answered your question can you please mark it as accepted so that other users can see it is correct when searching for similar answers.
Regards,
Kristians
I don't know if that would be any sort of best practice ... or if that's even possible with cloud, but on server, my first goto would be to store the token in a custom application property.
//store a custom property
ComponentAccessor.applicationProperties.setString("com.acme.myoauthtoken", "put your token here")
//retreive a custom property
def mytoken = ComponentAccessor.applicationProperties.getString("com.acme.myoauthtoken")
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.