oauth2-bundle icon indicating copy to clipboard operation
oauth2-bundle copied to clipboard

CORS issue

Open AdrienHarvel opened this issue 4 years ago • 0 comments

Hi,

I have an react frontend application with one url named https://front.xxxx.com And I have my Oauth backend write with Symfony 5.x and use trikoder/oauth2-bundle. This is another url named https://api.xxxx.com

When I try to get my access_token and refresh_token from https://front.xxxx.com, I got it : { "token_type": "Bearer", "expires_in": 18000, "access_token": "eyJ0eXAiOiJKV1...", "refresh_token": "def502001d1acea1be44d9b..." }

And It's good.

But, when I pass the access_token to Authorization header like Authorization: Bearer eyJ0XAiOiJKV1.... from the react frontend application, THEN I got : Access to XMLHttpRequest at 'https://api.xxxx.com/oauth2/v1/URI' from origin 'https://front.xxxx.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

What can I do to solve this problem ? I use nelmios_cors and I had * in allow_origin but nothing change.

AdrienHarvel avatar Nov 19 '20 17:11 AdrienHarvel