cakephp3 presence of auth token in API request code example
Example: cakephp3 presence of auth token in API request
public login( username : string,
password : string,
captchaResponse : string ) {
return this.http.post<any>( 'http://api.mydomain.localhost/users/token.json',
{
username,
password,
captchaResponse
},
{
headers : new HttpHeaders()
.set( 'X-Requested-With', 'XMLHttpRequest' )
}
).pipe( map( response => {
this.user = response.data;
this.setUser( this.user.profile );
this.setToken( this.user.token );
return this.user;
} ) );
}