javascript - 从hellojs获取refresh_token

标签 javascript oauth-2.0 hello.js

我正在使用hello.js从客户端使用社交网络登录用户。一切都按预期进行,但现在我发现我还需要 refresh_token,因为我必须使用来自服务器的客户端凭据。

所以,遵循docs :

Unlike Implicit grant; Explicit grant may return the refresh_token.

登录方法选项中:

response_type: Implicit (token) or Explicit (code) Grant flow

因此,我将选项 response_type: 'code' 添加到 init 方法中。

此外,我还添加了范围offline_access(scope docs(最后一个)):

Persist the tokens or acquire a Refresh Token for continued access

但是现在,当我尝试使用任何社交网络登录时,我收到此错误:

"The client_id "xxxxxxxxxxxxxxxxx" is unknown"

这很奇怪,因为 client_id 是正确的,删除​​此选项后它会按预期工作。

我错过了什么,还是这是一个错误?

最佳答案

由于您使用的显式授权流程需要服务器-服务器握手,因此您需要有一个由 HelloJS 的 oauth_proxy 设置定义的服务器才能执行握手,因此您看到的错误来自默认代理服务器//auth-server.herokuapp.com

参见http://adodson.com/hello.js/#oauth-proxy了解更多信息

关于javascript - 从hellojs获取refresh_token,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38431897/

相关文章:

javascript - 如何在别名任务中设置配置数据

javascript - 获取图像项目数并更新 owl carousel 2 中的中心选项

javascript - Hello.js 的 Twitter 错误

javascript - 在 Hello.js 中验证访问 token 时出错

javascript - 例如,如何编辑一个 HTML 文件的标题并使其对所有其他页面做同样的事情,而无需手动更改所有页面?

javascript - 数组或迭代器中的每个 child 都应该有一个唯一的 "key"属性。在 react js?

spring - 当我在授权 header 中发送我的有效承载 token 时,为什么我没有通过我的 Spring-Cloud Gateway/OAuth2-Client 进行身份验证?

javascript - 检索 LinkedIn 访问 token

java - 如何在 Gowalla Java (Android) 中获取访问 token

javascript - Hello.js 与 Passport.js?