Advertisement
Guest User

Untitled

a guest
Sep 7th, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. login(email: string, password: string): Observable<any> {
  2.     const body = `username=${encodeURIComponent(email)}&password=${encodeURIComponent(password)}&grant_type=password`;
  3.     let headers = new HttpHeaders();
  4.     headers = headers.append('Content-Type', 'application/x-www-form-urlencoded')
  5.     .append('Authorization', 'Basic ' + btoa(TOKEN_AUTH_USERNAME + ':' + TOKEN_AUTH_PASSWORD));
  6.     return this.http.post<any>(AUTH_API_URL, body, {headers: headers, observe: 'response'});
  7.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement