2017-10-12 85 views

回答

0

这是我的代码,替换你的用户名,密码和端口号。您可以在会话存储中检查令牌。

Login():void{ 
    const body='[email protected]&password=Zx123.&grant_type=password'; 
    let resp=this.http.post('http://localhost:11694/token',body, 
    {observe:'response'}).subscribe(res=>{ 
    sessionStorage.setItem('myToken',res.body['access_token']); 
    } 
); 
} 

Screenshot