我使用“ https://github.com/auth0/angular2-jwt ”将JWT令牌发送到我的服务器,当我调试http请求(角度)时可以看到令牌,但在服务器(java)上找不到令牌
这是我的配置 jwt
JwtModule.forRoot({
config: {
headerName: 'API_TOKEN',
tokenGetter: function tokenGetter() {
return localStorage.getItem('API_TOKEN');
},
whitelistedDomains: ['localhost:8092'],
// blacklistedRoutes: ['https://localhost:8092/login'],
authScheme: ''
}
}),
我添加了一个 JwtHttpInterceptor 来调试我的请求:
@Injectable()
export class JwtHttpInterceptor implements HttpInterceptor {
constructor() {}
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(req);
}
}
这是一个屏幕截图:标头请求中的 JWT 令牌
但服务器找不到这个令牌。
当我尝试使用 chrome 插件添加令牌时,它可以工作并且服务器可以找到我的令牌:使用 chrome 插件添加的令牌
你能帮我吗?