JS hide auth details


When sending auth request e.g retreiving customfield id thats not on the page, i require to perform an ajax request to jira rest api with providing the auth credentials. These credentials can be seen on the client side when viewing page source code.

Is there a method to hise the auth credentials or any ideas?

Many thanks in advance for the help,

1 answer

0 votes
Micky Caritte Community Champion Dec 15, 2017


Instead of sending auth credentials you might want to reuse client's JSESSIONID (cookie) which won't expose people credentials :)

Hope this helps!

Thanks Micky!

I'm sorry, I'm quite new to using sessions (cookies). 


Is there an example somewhere i can go off with using cookies to get custom field values? 


I really appreciate your help. 




Micky Caritte Community Champion Dec 18, 2017

After a second thought, you should not need authentication if your script is executed in an authenticated context. User and password from current session will be saved.

If you need to authenticate the AJAX with another user's credentials, you can use Basic Auth with AJAX as explained here: https://zinoui.com/blog/ajax-basic-authentication

That's a good way to "hide" credentials. I guess it's far better than generating a cookie and reusing it as you'll need to pass the credentials to generate a cookie anyway :)

Please note that Basic Auth is reversible and I can't imagine any "truely secure" way of authentication through ajax with no credentials displayed.

Hope this helps!

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,760 views 11 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot