我正在使用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?