I try to make an Angular call to the Strapi API. When I use the same jwt value as passed to this method, I get 200 and new restaurant is inserted into the Strapi DB. But when I use Angular with a code as below I get "403 Forbidden" error:
addRestaurant(restaurant, jwt) {
const t = 'Bearer ' + jwt;
const params = {data: restaurant, headers: {Authorization: t}};
return this.httpClient.post('http://localhost:1337/restaurants', params);
}
The headers should be given separately to the data that you want to post.
Post function should be used like this.
In your case, it should be something similar like that: