我正在使用 Kinvey 在我的 AngularJS 应用程序上处理 Oauth,它在 Facebook 上运行良好,但是当我尝试使用 Google 登录时,出现 400 错误:
错误:invalid_request
redirect_uri 的参数值无效:不允许片段:localhost:9000/#/login
有没有人在使用 Google Oauth 和 Angular 时遇到过这个问题?关于如何解决它的任何想法?该问题源于 Angular 路由的 URL 中的哈希值。
最佳答案
#
被称为 fragment identifier
.错误 Fragment not allowed:
意味着您必须更换 #
使用替代方法,例如:
然后使用 Kinvey 重定向:
req.request({uri: 'http://localhost:9000/route/login',
method: 'GET'},
function(error, response, body){
response.statusCode = 302;
response.setHeader("Location", "/#/login");
response.end();
}
);
以下是一些与类似问题无关的问题:
关于AngularJS Google Oauth 400 错误 redirect_uri : Fragment not allowed 的参数值无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24254791/