import { Injectable } from '@angular/core' ; import { Observable } from 'rxjs/Observable' ; import { HttpClient , HttpHeaders } from '@angular/common/http' ; @ Injectable ( ) export class AuthService { baseUrl : 'http://localhost:8080/email2sms/' ; constructor ( private http ) { } attemptAuth ( ussername , password ) { const credentials = { username : ussername , password : password } ; console . log ( 'attempAuth ::' ) ; return this . http . post < any > ( 'http://localhost:8080/token/generate-token' , credentials ) ; } }