6

我正在使用 Kinvey 在我的 AngularJS 应用程序上处理 Oauth,它适用于 Facebook,但是当我尝试使用 Google 登录时,我收到 400 错误:

错误:invalid_request

redirect_uri 的参数值无效:不允许使用片段:localhost:9000/#/login

有没有人在使用 Google Oauth 和 Angular 时遇到过这个问题?关于如何解决它的任何想法?问题源于 Angular 路由的 URL 中的哈希值。

4

1 回答 1

3

#称为fragment identifier. _ 该错误Fragment not allowed:意味着您必须将 替换为#替代项,例如:

  • 本地主机:9000/路由/登录

然后用 Kinvey 重定向:

req.request({uri: 'http://localhost:9000/route/login',
method: 'GET'},
function(error, response, body){
  response.statusCode = 302; 
  response.setHeader("Location", "/#/login");
  response.end();
  }
);

以下是一些与类似问题无关的问题:

于 2014-09-29T19:25:34.960 回答