Guest User

Untitled

a guest
Feb 20th, 2018
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Injectable()
  2. export class HttpService {
  3.  
  4.   constructor(private http: HttpClient) { }
  5.   public login(email, password) {
  6.     const aUsername = "client";
  7.     const aPassword = "clientpassword";
  8.     const headers: HttpHeaders = new HttpHeaders();
  9.     headers.append("Content-Type", "application/x-www-form-urlencoded");
  10.     headers.append("Authorization", "Basic" + btoa(aUsername + ':' + aPassword));
  11.     const params = { grant_type: "password", username: email, password: password };
  12.     console.log(address + "/oauth/token", params, {headers: headers});
  13.     return this.http.post(address + "/oauth/token", params, {headers: headers});
  14. }
  15. }
Add Comment
Please, Sign In to add comment