Advertisement
Guest User

Untitled

a guest
Oct 4th, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   public login(user: string, password: string): Observable<any> {
  2.     const body = new HttpParams()
  3.       .set(`grant_type`, `password`)
  4.       .set(`username`, user)
  5.       .set(`password`, password);
  6.     const headers = new HttpHeaders({
  7.       'Content-Type': `application/x-www-form-urlencoded`,
  8.       'Authorization': `Basic Y2xpZW50OnNlY3JldA==`})
  9.  
  10.     return this.http.post(api+`oauth/token`, body.toString(), { headers: headers, withCredentials: true })
  11.       .pipe(
  12.         map((res: any) => res)
  13.       , catchError((err: any) => {throw(err)})
  14.       )
  15.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement