jquery - Spring Boot+ Oauth 2.0 +Zuul Proxy for third party access -
i trying create restapi using spring boot + oauth 2.0 , want access same web application.
my spring application deployed @ localhost:8585/oauth/token. if use chrome rest extenstion calling works fine when trying oauth token web application using jquery ajax call gives me following error
'xmlhttprequest cannot load localhost:8585/oauth/token. no 'access-control-allow-origin' header present on requested resource. origin ' localhost:8080' therefore not allowed access. response had http status code 401.'
i referred documentation , @enablezuulproxy can enable proxy server didnt work
application.class
import org.springframework.boot.springapplication; import org.springframework.boot.autoconfigure.springbootapplication; import org.springframework.cloud.netflix.zuul.enablezuulproxy; @springbootapplication @enablezuulproxy public class application { public static void main(string[] args) { springapplication.run(application.class, args); } } web application page calls oauth/token clientid , client secret , grant type client_credential using jquery ajax call
and application.yml
zuul: routes: resource: path: oauth/* url: http://localhost:8080/ stripprefix: false and oauth server http configuration
.antmatchers("/oauth/token").authenticated() .and().csrf().csrftokenrepository(csrftokenrepository()).and() .addfilterafter(csrfheaderfilter(), csrffilter.class);
Comments
Post a Comment