Angular调用Asp.net Core JWT Authentication接口
程序员文章站
2022-06-15 18:52:05
基本思路是调用登录接口,获取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类的笔记