Chefk5
Chefk5

Reputation: 469

Spring Boot / JWT application gives access denied in browser but works in postman. Why?

We are using Swagger and and we need to use the browser in order to display swagger documentation. But For some reason, JWT doesn't allow chrome to access the application and gives access denied.

We followed this tutorial for JWT https://auth0.com/blog/securing-spring-boot-with-jwts/

Upvotes: 0

Views: 580

Answers (1)

Himeshgiri gosvami
Himeshgiri gosvami

Reputation: 2884

that is cors option method problem. you need to grant access option method try this on security

public class CustomSecurity extends WebSecurityConfigurerAdapter{

  @Override
  protected void configure(HttpSecurity http) throws Exception { 
      http.csrf()
        .disable()
        .authorizeRequests().antMatchers(HttpMethod.OPTIONS).permitAll() ....

}
}

Upvotes: 1

Related Questions