Encountering an error when trying to upload data to my backend Firebase database.
Here are the relevant code snippets:
storeUsers(users: any[]){
return this.http.post('https://promise-90488.firebaseio.com/data.json', users);
}
appcomponent.ts:
const result = Object.assign({}, this.userForm.value );
console.log(result);
this.userService.storeUsers(result)
.subscribe(
(response) => console.log(response),
(error) => console.log(error)
);
The error messages are as follows:
POST 401 (Unauthorized) app.component.ts:37 HttpErrorResponse {headers: HttpHeaders, status: 401, statusText: "Unauthorized", url: "", ok: false, …} error: {error: "Permission denied"} headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ} message: "Http failure response for : 401 Unauthorized" name: "HttpErrorResponse" ok: false status: 401 statusText: "Unauthorized" url: "" proto: HttpResponseBase