未设置Angular 5 http.post授权标头

时间:2018-08-23 12:52:42

标签: spring-boot spring-security oauth-2.0 angular5 spring-security-oauth2

const httpOptions = {
          headers: new HttpHeaders({
            'Content-Type':  'application/x-www-form-urlencoded',
            'Authorization': 'Basic d2ViYXBwOjExMTE=',
            'Access-Control-Expose-Headers' : 'Authorization',
            'Accept' : 'application/json'
          })
        };
    return this.http.post(oauth2_token_endpoint, {}, httpOptions);

Http Request的屏幕截图是: enter image description here

请帮助。

1 个答案:

答案 0 :(得分:0)

const httpOptions = {
    headers: new HttpHeaders({ 'Content-Type': 'application/json' })
  };