我如何在代码中获取此信息?,我正在使用angular 6和Spring安全性,但是我需要获取响应的标头中的令牌。
我发帖:
const httpoptions = {
headers: new HttpHeaders({ 'Content-Type': 'application/json; charset=UTF-8',
"Access-Control-Allow-Origin": "*",
"Access-Control-Expose-Headers": "",
"Access-Control-Allow-Headers": "Content-Type, body, Authorization ",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS"
})
};
@Injectable({
providedIn: 'root'
})
export class LogueoService {
private censoURL = 'http://localhost:8080/login';
constructor(private http: HttpClient) { }
inicio (username:string,password:string) {
return this.http.post<any>(this.censoURL, {username, password }, httpoptions );
}
}