Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to logout current user?

valerian Baillet June 11, 2018

Hi,

I try to add a button to logout in my plugin.

Which function can I use to logout the current user ?

 

Best regards,

1 answer

1 accepted

1 vote
Answer accepted
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 11, 2018
valerian Baillet June 11, 2018

Thanks for your answer.

For the parameters of the method, I would like to return to the login page.

Can I juste past null for the two parameters?

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 11, 2018

No, you can not set nulls. You must call this function either in a servlet or something like this. When exactly do you want to have a user logged out?

valerian Baillet June 11, 2018

Ok That's what I thought.

I made a modal which appears when the user is connected to the portal for the first time.

He had to accept, or he had to logout.

I had the button, the js function to call the rest API of my plugin and I have to logout my current user and redirect the user to the login page.

 

I hope that I'm clear.

valerian Baillet June 11, 2018

Just an information, I use the Ultimate theming plugin to add js to portals

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 11, 2018

Oh, I see. I am not familiar with this plugin. You should ask the developers of the plugin on how you can use the Java Api. Or if it is JS, just make the same request, which is created, when you use the logout button in Jira. Open the Developer Tools in your browser and have a look at what request is made, when you logout. And repeat this request in your JS.

valerian Baillet June 11, 2018

You're right. i will try this. Thanks again

valerian Baillet June 12, 2018

 I use the rest API using the url : '/rest/auth/1/session', directly from my js file.

 

Thank for all.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events