How to get data from servlet

I followed this tutoial: https://developer.atlassian.com/docs/common-coding-tasks/creating-an-admin-configuration-form
I want the admin to save an oAuthToken via the adminConfig. But when im trying to GET the token with my plugin i get a 401.
I found out, that the js uses a JSESSIONID to PUT the token but i dont know how i get this id within my java plugin.
I dont want to set the @GET @AnonymousAllowed because the token should only be accessible for loggedin users.

Hi @flowyoe,

Do you just want to let logged in users to access your servlet? Or are you going to use the oauthToken for something else?

Cheers,
Anne

The oauthToken will be used to send queries to endpoints. So when a logged in user uses my plugin the plugin should be able to get the token from the servlet.
I thought that this is what a servlet is for.

Hi @flowyoe,

By “endpoints”, Confluence’s REST API endpoints?

Cheers,
Anne

No the endpoints have nothing todo with confluence. They are RDF endpoints.

I want to enable the admin to save some information, that configures my plugin. Thats why i followed the “Creating an Admin Configuration Form” tutorial.
And than the (java)plugin has to access the information which unfortunately wasn’t part of the tutorial. And i want the information to be only accessible by logged in users(everybody that has access to the plugin).

So I guess there is no way to querie data from the servlet with a java plugin without setting @GET @AnonymousAllowed.