【问题标题】:How to retrieve the redirect URL in phonegap android application when using custom oauth2 provider使用自定义 oauth2 提供程序时如何在 phonegap android 应用程序中检索重定向 URL
【发布时间】:2014-03-08 13:31:32
【问题描述】:

我正在使用 phonegap android 应用程序实现 oauth2,但在检索重定向 URL 时遇到了问题。

以下是服务器在成功授权后重定向到的重定向 URL。

http://localhost/tutorsapp/assets/www/#state=123&access_token=b3edb8eec17c7f99048f7132836dd822f0078a702842928e197efe37eba6959215216e1b677ca96906d5dfcc0ae17d35b4b1&token_type=bearer&expires_in=10800

我想知道如何在 Javascript 中检索重定向的 URL,以便我可以保存 access_token。

我试过 window.location.href。但这不起作用。

提前感谢您的帮助!

【问题讨论】:

    标签: android cordova


    【解决方案1】:

    看起来 access_token 和其他参数在 URL 的哈希片段中。

    使用 window.location.hash 并解析 access_token

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-05
      • 2014-03-06
      • 2013-05-21
      • 2016-09-30
      • 1970-01-01
      • 2021-08-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多