This repository has been archived by the owner on May 31, 2022. It is now read-only.
Access to XMLHttpRequest ''http://192.168.3.106:8080/sac/oauth/token' from origin 'http://localhost:3001' 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. #1944
Labels
good morning, I have an API raised in Payara Server, when I try to log in on the front of the error in cors but testing on Postmam the token request works normally because Postmam does not check the Cors, the error I have returned on the login screen is: "Access to XMLHttpRequest at 'http://192.168.3.106:8080/sac/oauth/token' from origin 'http://localhost:3001' 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."
The normal thing is to login correctly in the fronto which is controlled by Cors / Oauth2
CorsConfig:
import java.util.Collections;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
@configuration
public class CorsConfig {
}
Pom.xml
-->
Sample
The text was updated successfully, but these errors were encountered: