AngularJS Google Oauth 400 错误 redirect_uri : Fragment not allowed 的参数值无效

标签 angularjs oauth kinvey

我正在使用 Kinvey 在我的 AngularJS 应用程序上处理 Oauth,它在 Facebook 上运行良好,但是当我尝试使用 Google 登录时,出现 400 错误:

错误:invalid_request

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

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

最佳答案

#被称为 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();
      }
    );
    

    以下是一些与类似问题无关的问题:
  • 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 Google Oauth 400 错误 redirect_uri : Fragment not allowed 的参数值无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24254791/

    相关文章:

    javascript - 我将如何利用 ng-repeat 而不是 Javascript 循环在我的下拉列表中创建年份列表?

    open-source - Twitter xAuth 与开源

    android - 无法根据链接接收对象

    android - 收到多条推送通知

    javascript - 隐藏表格内容/剪切angular js,Html中的内容

    java - SpringSecurity - SecurityConfiguration.java - HttpSecurity - 不工作

    javascript - ng-绑定(bind)数据没有选择第二个选择

    php - PHP 的 oAuth 签名创建问题(将照片集发布到 Tumblr)

    python - 如何使用授权类型为 'Client Credentials' 的请求 OAuthlib ?

    javascript - Trigger.io 中是否有处理 Twitter 的 OAuth1.0a 的好方法?