从标题中检索令牌

时间:2019-06-14 11:56:01

标签: angular7

我在Angular7-Spring启动中从事一个项目。我使用SpringSecurity和jwt进行身份验证,后端部分可以工作,并且我有令牌,但是在前端部分,我无法检索它。

我使用SpringBoot 2和angular 7。

onSignIn(data) {
    this.authService.signin(data).subscribe(resp=> { 
        console.log(resp.headers.get('Authorization'));
    }
}

Response Headers : 
Access-Control-Allow-Origin: *
Authorization: eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImlhdCI6MTU2MDUxMjQzMSwiZXhwIjoxNTYwNTk4ODMxfQ.FFp5OThmOgUm7Bk4QfDAOpuNTgXEGrtHAQECAqSx0caJp8z8SHTaJSclou1kMThi6ioCYTi_0xPJ_cMqkJ4vBg
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: application/json;charset=UTF-8
Date: Fri, 14 Jun 2019 11:40:30 GMT
Expires: 0
Pragma: no-cache
Transfer-Encoding: chunked
Vary: Origin, Access-Control-Request-Method, Access-Control-Request-Headers
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block

使用这些信息,我将为空。

我不知道问题出在哪里。

0 个答案:

没有答案
相关问题