当前位置: 移动技术网 > IT编程>开发语言>JavaScript > Angular调用Asp.net Core JWT Authentication接口

Angular调用Asp.net Core JWT Authentication接口

2018年10月30日  | 移动技术网IT编程  | 我要评论

基本思路是调用登录接口,获取token,使用token请求其他jwt接口:

gethomedetails(): observable<homedetails> {
    let headers = new headers();
    headers.append('content-type', 'application/json');
    let authtoken = localstorage.getitem('auth_token');
    headers.append('authorization', `bearer ${authtoken}`);
  
    return this.http.get(this.baseurl + "/dashboard/home",{headers})
      .map(response => response.json())
      .catch(this.handleerror);
}  

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网