Skip to content
Advertisement

antMatchers() is not working , and gives forbidden error

I have an end-point called authenticate , this endpoint is given to antMatchers(“/authenticate”) to skip authorization for this end-point, but it still checks for the authentication.

code:

JavaScript

Advertisement

Answer

I have an update regarding the issue.

In my case, I had a problem with a function singWith() that was deprecated, the request of /authenticate was passing the antMatchers() filter but was not able to generate the token.

After the research, I found that there are other types of the same function, which works fine.

the old version of the token generation code.

JavaScript

Key is of SecretKey type

JavaScript

here is the new version of the token generation code.

JavaScript

Key is of String type

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement