hello I'm trying to build authentication i have a sign up and login form , the backend built with Laravel ,Rest APIs works correctly with Postman so the problem almost is from the angular app when i'm trying to send a request i get this error
POST https://masterytest.000webhostapp.com/public/api/Login polyfills.js:3156 net::ERR_HTTP2_PROTOCOL_ERROR
HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: "Unknown Error", url: "https://masterytest.000webhostapp.com/public/api/Login", ok: false, …} error: ProgressEvent {isTrusted: true, lengthComputable: false, loaded: 0, total: 0, type: "error", …} headers: HttpHeaders message: "Http failure response for https://masterytest.000webhostapp.com/public/api/Login: 0 Unknown Error"
I'm hosting my Laravel project on 000webhost
I use and interceptor to attach a token to every request and user Id to every ongoing request except the signup
intercept(req: HttpRequest<any>, next: HttpHandler) {
return this.authService.newUser.pipe(
take(1),
exhaustMap(user => {
if (!user) {
req.clone({
headers: new HttpHeaders({
Authorization: '',
User_ID:'',
})
});
return next.handle(req);
}
const modifiedReq = req.clone({
headers: new HttpHeaders({
Authorization: user.token,
User_ID:user.User_ID,
})
});
return next.handle(modifiedReq);
})
);};
and I have an Authservice ,I store the user in this new user and this is my log in
newUser = new BehaviorSubject<User>(null);
userLogin(nameEmail: string, password: string) {
return this.http
.post<AuthResponseData>(
'https://masterytest.000webhostapp.com/public/api/Login',
{
Secret_Key:"******",
nameEmail :nameEmail ,
password : password
}
)
.pipe(
//catchError(this.handleError),
tap((resData) => {
this.handleUserAuth(
resData.User_ID,
resData.User_Token,
resData.User_Type,
resData.User_Name
);
})
);
}
then I subscribe in the log in component