Angular调用Asp.net Core JWT Authentication接口
程序员文章站
2022-03-04 14:02:21
基本思路是调用登录接口,获取token,使用token请求其他JWT接口: ......
基本思路是调用登录接口,获取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); }
上一篇: js类的笔记