About Getting Session For Using REST API

There are two ways you can authenticate against KNIME Server REST API endpoints: JWT and Basic authentication .

I want to get KNIME Session.
REST API EndPoint is ’ http://{knime_server}/knime/rest/v4/auth/session’

I tried to authenticate using JWT. The response value contains only cookie information.
The header does not contain Set-Cookie information.
Even though the session was created, this cookie doesn’t work properly.

When I try to authenticate using Basic Auth, there are cookie information in the response value and Set-Cookie information in the header.
Please refer to the picture below.

I want to get JSESSIONID using JWT Authentication

Please Let me know why the jwt authentication doesn’t work properly.

The session is created by the Tomcat application server. JWT authentication is something we added to Tomcat which bypasses certain parts of the Tomcat authentication. Therefore Tomcat cannot create a session when using JWT authentication, only when you provide you username and password using BASIC auth.

1 Like

Then, Is there any meaning in the session that was created by JWT Authentication?

I was able to find this session was created through Tomcat manager by using JWT Token, but this session is in a slightly different format.

Then, how can I use the cookie (JSSESSIONID) in respones when I requested the REST API using JWT authentication?
It’s created in Tomcat, but I can’t use it. Is there really no way?

Tomcat creates sessions in a two-step process. First an anonymous session is created. Then you have to provide username and password and this anonymous session and in return you get an authenticated session. This doesn’t work without providing both username and password and therefore it won’t work with JWT.
The question is more: if you already have a JWT why do you need a session?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.