有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java没有使用Spring Security OAuth的“AccessControlAllowOrigin”头

我正在尝试使用示例https://github.com/spring-guides/tut-spring-boot-oauth2将facebook登录添加到我的Spring Boot应用程序中

我使用的是非常简单的示例“click”(https://github.com/spring-guides/tut-spring-boot-oauth2/tree/master/click)。当我运行该示例时,一切都正常。然而,在我的应用程序中尝试同样的操作会导致JavaScript问题(当我单击“登录”链接时发生):

XMLHttpRequest cannot load https://www.facebook.com/dialog/oauth?client_id=123456789&redirect_uri=http://localhost:8080/login&response_type=code&state=fc9RzD. 
No 'Access-Control-Allow-Origin' header is present on the requested resource. 
Origin 'http://localhost:8080' is therefore not allowed access.

我真的不明白为什么这个例子有效,而且在我的代码中没有。据我所知,facebook服务器需要添加这个标题,所以如果它为教程示例添加了这个标题,那么它也应该为我的应用程序添加这个标题,对吗

我使用与示例应用相同的客户端id和客户端机密,所以我猜它不能是facebook设置


共 (0) 个答案