Could not Verify the provided CSRF token because your Session was not found

Asked

Viewed 466 times

0

I’m using Spring security 4.2.3 and spring 4.2.5 when I run the login screen and the user registration screen works correctly however when I ask to access the home screen. this error appears:

messageCould not verify the provided CSRF token because your session was not found.

descriptionAccess to the specified resource has been forbidden.

1 answer

0


CSRF means Cross Site Request Forgery and is a kind of attack on websites. Spring Security documentation discusses the subject at this link, it is highly recommended that you read this documentation topic.

You can disable CSFR with the following code in your Websecurityconfig:

  @Override
        protected void configure(HttpSecurity http) throws Exception {
            http
                .csrf().disable();
        }

This code and other details on the subject can be seen on the second link passed in the first paragraph.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.