Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7540923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:45:38+00:00 2026-05-30T07:45:38+00:00

We have app with REST API. It is based on Spring, Spring security is

  • 0

We have app with REST API. It is based on Spring, Spring security is used as well.
For example, we configured some role-based restrictions:

<sec:http auto-config="true" access-decision-manager-ref="accessDecisionManager">
    <sec:intercept-url pattern="/auth/authenticate" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
    <sec:intercept-url pattern="/auth/logout" access="IS_AUTHENTICATED_FULLY"/>
    <sec:intercept-url pattern="/users/**" access="USER"/>
</sec:http>    

It works fine with cookies, but now we need to enable the possibility to pass jsessionid as URL param instead of cookies. I thought we don’t need to change anything in our code, but something goes wrong.
I request /login method and copy jsessionid from response. After that I try to request
/users;jsessionid=* and got 401 status code, this means that application didn’t recognize me. What should we change in order to make this approach work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:45:40+00:00Added an answer on May 30, 2026 at 7:45 am

    Generally, a cookies based authentication system is not good for XML based APIs (like SOAP and REST). The practice is to authenticate on every API call.

    Check this post in the same forum. Quoting the post :

    A REST service is generally authenticated on each and every request,
    not normally by a session.

    Now the reasons for this is

    • The clients or consumers for these type of xml bases APIs are not browsers but other applications.
    • Browser understand cookies, in fact cookies are aimed for browser based users but not the applications in general.
    • The Client may or may not understand cookie and in most of the cases will NOT understand as Cookies is not a standard approach for authentications for these type of APIs.

    There are better ways than handling this in non-standard cookie way. Not sure which version of spring-security you are using, HERE is an example of spring-security 3.1 used to secure a RESTful application.

    EDIT:

    Check out this link. This forces tomcat (not sure if you use tomcat) to not handle session using cookies. But once done, this will not handle cookie based session. I am not 100% sure it will work, you can try nonetheless.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a largely navigation-based iPhone app that communicates with a REST API
I have a app with a kind of rest api that I'm using to
I have a Grails app running on 1.3.7 with the json-rest-api plugin version 1.0.8
I'm writing a app that exposes a REST API. Some of the query parameters
I want to build a REST web service on app engine. Currently i have
for example: I have app A, which references library A and library B. in
I have an app using PHP and the PayPal API. The basic way it
I have a REST API written in PHP located on Apache server. It takes
I am working on a REST API to be used by a mobile application
I have an existing, fully functional Spring web application based on Spring 2.5.6 -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.