Can’t POST or PATCH on server, got 403 forbidden with api-platform

I have an issue since several days.

I’m creating an API with Symfony 5 and Api-platform.

I add a JWT auth with LexikJWTAuthenticationBundle. I have no problem for register, login or GET my entity.

When I start the API on my computer I can POST and PATCH on localhost without any problem but when I want to POST or PATCH an entity on my server I always have this response :

<html>

<head>
    <title>403 Forbidden</title>
</head>

<body>
    <h1>Forbidden</h1>
    <p>You don't have permission to access this resource.</p>
</body>

</html> 

I have this response if I send a request with a valid token or without any token.

Maybe it is a problem with CORS or CSRF ? But I can’t find a solution.

Does someone have an idea ?

Thanks a lot for your help

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *