I want to request Token from API with:
Signin(email: string, password: string): void {
let data: Object = {
client_id: 2,
client_secret: 'vSFxVqALQHjyotPyGfhrGj3ziudUGsts2ZWiAGms',
grant_type: 'password',
username: email,
password: password,
};
this._HTTP.post(
this.OAuth + 'token',
data,
{headers: this.Headers}
).toPromise()
.then( (_response) => {
console.log (_response);
});
}
And i receive an error with 401 Unauthorized
21:54:03.996 ERROR Error: Uncaught (in promise): Response with status: 401 Unauthorized for URL: http://localhost:8000/oauth/token
I don't understand why I get this error, I added in Kernel -> middleware -> web this:
\Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,