我正在使用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
关于javascript - 从hellojs获取refresh_token,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38431897/