首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Angularjs Satellizer Twitter登录错误重定向

Angularjs Satellizer Twitter登录错误重定向
EN

Stack Overflow用户
提问于 2015-05-08 10:01:53
回答 1查看 608关注 0票数 0

我正在尝试用satellizer为twitter实现一个登录。我正在遵循satellizer存储库上的示例,因此在客户端,我执行以下操作:

代码语言:javascript
复制
$auth.authenticate('twitter')
     .then(function (res) {
           console.log(res);
     });

在服务器端,我跟踪他们的OAuth1.0登录流:

代码语言:javascript
复制
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错误:

代码语言:javascript
复制
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore not allowed access.

我查看了它们的php/Laravel示例,它们使用重定向,但对我来说却不起作用。

我该如何解决这个问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-11-03 13:20:15

您需要在您的index.php文件中添加访问控制-允许-原产地标题。在服务器端,打开index.php并在<?php之后添加该行

代码语言:javascript
复制
header("Access-Control-Allow-Origin: *");
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30121061

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档