title: Spring boot, JWT and angular not working : HTTP status code 403 error for method put
body: <p>I  am  new  to  angular  and  spring-security.  I am  having  problem  with  updating  my  data  from  angular  but  i  can update  it  using  insomnia  when  i  test  my  api  (i pass  the  token  in  the  header).</p>
  
  <p>Im  passing  the  token  to  the  put   method  but  i  get  access denied  403  </p>
  
  <p>this  is  my  function  in  angular  service    </p>
  
  <pre><code>  private headers = new HttpHeaders({
      'Content-Type': 'application/json',
      'Authorization':  this.authService.jwt
      });
  updateUserById(id: String): Observable&lt;any&gt; {
      console.log(this.headers);
  
      return this.http.put(this.host_3 + '/' + id, {headers: this.headers});
    }
  </code></pre>
  
  <p>this  is  my  function  in  component  controller</p>
  
  <pre><code>onSubmit(){
     this.updateCustomer();
    }
    updateCustomer(){
      console.log("inside update"+this.userr);
      this.coordservice.updateUserById(this.userr).
      subscribe(data =&gt; console.log("data"+data), error =&gt; console.log(error));
    }
  </code></pre>
  
  <p>this  is  my  backend  function  in  spring  controller</p>
  
  <pre><code> @PutMapping(value = "/customersList/updateCustomer/{idCustomer}")
      public ResponseEntity&lt;Customer&gt; update(@PathVariable(name = "idCustomer") String idCustomer, @RequestBody Customer customer){
          this.customerService.updateCustomer(idCustomer,customer);
          return new ResponseEntity&lt;Customer&gt;(customer, HttpStatus.NO_CONTENT);
      }
  
  </code></pre>
  
  <p>Security configuration</p>
  
  <pre><code>rotected void doFilterInternal(HttpServletRequest request,HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
  
  
          response.addHeader("Access-Control-Allow-Origin", "*");
          response.addHeader("Access-Control-Allow-Headers", "Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, authorization");
          response.addHeader("Access-Control-Expose-Headers", "Access-Control-Allow-Origin, Access-Control-Allow-Credentials, authorization");
          response.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH");
  </code></pre>
  
  <p>Note:  i  can  get  data  using  http.get()  but  for  method   put  i  get  access denied</p>