我正在尝试用satellizer为twitter实现一个登录。我正在遵循satellizer存储库上的示例,因此在客户端,我执行以下操作:
$auth.authenticate('twitter')
.then(function (res) {
console.log(res);
});在服务器端,我跟踪他们的OAuth1.0登录流:
Client: Open a popup window via $auth.authenticate('provider name').
Client: Unlike OAuth 2.0, you cannot go directly to the authentication screen without a valid request token.
Client: The OAuth 1.0 flow starts with the GET request to /auth/provider inside the popup.
Server: Check if URL contains oauth_token and oauth_verifier parameters.
Sever: Initially it does not, so send an OAuth signed POST request to the /request_token URL.
Server: Redirect to the /authenticate URL with a valid request token.但是,当我重定向到/authenticate URL时,我会得到一个CORS错误:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore not allowed access.我查看了它们的php/Laravel示例,它们使用重定向,但对我来说却不起作用。
我该如何解决这个问题?
发布于 2015-11-03 13:20:15
您需要在您的index.php文件中添加访问控制-允许-原产地标题。在服务器端,打开index.php并在<?php之后添加该行
header("Access-Control-Allow-Origin: *");https://stackoverflow.com/questions/30121061
复制相似问题