2017-10-12 67 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