Access to XMLHttpRequest at ‘http://localhost:8000/oauth/token’ from origin react app has been blocked by CORS

I am using oauth2 in springboot for the server side and React application on the Client. I am sending the token request for the grant_type = client_credentials /oauth/token from react application and get the Above error.

I have used @CrossOrigin and also used http.cors() for the global security congig. but still keep seeing the Preflight cross block error in browser console.

Access to XMLHttpRequest at ‘http://localhost:8000/oauth/token’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: It does not have HTTP ok status.
xhr.js:177 POST http://localhost:8000/oauth/token net::ERR_FAILED

Source: React – Stack Overflow

October 8, 2021
Category : News
Tags: oauth-2.0 | reactjs | spring boot | spring-security | spring-security-oauth2

Leave a Reply

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

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.