AngularJS Google Oauth 400错误redirect_uri的参数值无效:不允许使用片段

前端之家收集整理的这篇文章主要介绍了AngularJS Google Oauth 400错误redirect_uri的参数值无效:不允许使用片段前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用Kinvey在我的AngularJS应用程序上处理Oauth,它适用于Facebook,但是当我尝试使用Google登录时,我收到400错误

错误:invalid_request

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

有没有人遇到过Google Oauth和Angular这个问题?关于如何绕过它的任何想法?该问题源于Angular路由的URL中的哈希值.

解决方法

#被称为片段标识符.错误片段不允许:表示您必须将#替换为替代,例如:

> localhost:9000 / route / login

然后与Kinvey重定向

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

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

> Redirect to different page url in Node.js (Not in express or other frameworks)
> Redirecting client with NodeJS and Restify
> URI encoding in Yahoo mail compose link
> URL fragment missing from redirect URI
> Why URI-encoded (‘#’) anchors cause 404,and how to deal with it in JS?

猜你在找的Angularjs相关文章