- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在使用oauth2orize和passport在nodejs中创建一个API,但是当我请求 token 时,client_id参数未定义。
Oauth2orize:
server.exchange(oauth2orize.exchange.password(function (client, username, password, scope, callback) {
console.log(client); // This is undefined
帖子:
grant_type: password,
client: id_client, // I tried with client_id, clientId, id...
username: username,
password: password
为什么客户端参数未定义?
非常感谢
最佳答案
您需要创建至少一个如下所示的护照策略:
var passport = require('passport'),
ClientPasswordStrategy = require('passport-oauth2-client-password').Strategy ;
passport.use("clientPassword", new ClientPasswordStrategy(
function (clientId, clientSecret, done) {
Clients.findOne({clientId: clientId}, function (err, client) {
if (err) return done(err)
if (!client) return done(null, false)
if (!client.trustedClient) return done(null, false)
if (client.clientSecret == clientSecret) return done(null, client)
else return done(null, false)
});
}
));
然后您需要绑定(bind)您的路线,以便您的请求能够通过抛出此策略:(带有express)
app.post('/url', passport.authenticate('clientPassword'), server.token());
最后,要请求您的 token ,POST 参数必须是:
关于node.js - grant_type=password 上未定义 client_id (oauth2orize),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26302356/
我想了解 grant_type=client_credentials 之间的区别和 grant_type=password在Authentication或在 OAuth2 Flow概念。 我正在关注以
我在第一次尝试请求访问 token 时收到 {"error_description":"Missing grant_type parameter value","error":"invalid_req
我向我的领域添加了自定义 OIDC 身份提供商,并且想要使用直接访问授权流程(或 grant_type=password),但这不起作用。 Keycloak可以吗? 当尝试使用授权代码流程时,一切正常
我在我的本地机器上独立运行了 keycloak。 我创建了名为“spring-test”的新领域,然后创建了名为“login-app”的新客户端 根据其余文档: POST: http://localh
我正在尝试使用 Postman 工具从 Microsoft Graph API 获取 accessToken。我正在使用 Type=oauth2.0 的 Authorization 选项卡中尝试它,以
我一直在尝试创建一个 access_token对于我的 api。我已经 followed the setup并且正在使用 Postman 测试/创建 token 。我似乎无法通过 invalid_gr
我按照文档所示将 grant_type 参数放入请求正文中,但 Microsoft Graph 仍然提示该参数不存在; const tokenRequestBody = [ "grant_ty
我尝试通过 TypeScript 中的 XHR-Request 访问我的 OAuth2 token 。我不断收到 400: {"error":"unsupported_grant_type","err
我正在尝试通过 disqus API 检索 access_token。 这是我的网址: https://disqus.com/api/oauth/2.0/access_token/?client_id
我正在使用 Django OAuth Toolkit,并且成功创建了sign_up 调用 - 这反过来给了我以下响应: { "username": "boban16", "client_id"
我正在尝试找出 API documentation用于 Paypal 自适应支付。所以我正在尝试翻译这个 curl 命令(示例): curl https://api.sandbox.paypal.co
我按照谷歌文档为我公司的桌面应用做了一个“用谷歌登录”,文档链接: https://developers.google.com/identity/protocols/OAuth2InstalledAp
我在通过 OAuth 对 Youtube API 进行身份验证时遇到问题。它给了我这个错误: “错误”:CURL 的“invalid_grant” “错误”:“无效请求”, “error_descri
我正在尝试使用 cURL 请求访问 salesforce 沙箱帐户。我已经使用成功运行的单独 salesforce 开发人员帐户创建了类似的 cURL 请求;但是,在修改该请求的信息后,我收到一个错误
我开始使用 intridea ( http://github.com/intridea/oauth2 ) 的 oauth2 gem,但不知道如何解决这个问题。我已经开发了客户端和服务器,并且在请求 a
我正在根据此文档:( https://developers.vendhq.com/documentation/oauth.html#oauth)使用OAuth 2.0进行授权,并出现以下错误: "er
我使用的是 IdentityServer4 包的 1.0.0 版。 "IdentityServer4": "1.0.0" 我创建了一个客户端 new Client { ClientId = "
我在 Lumen 微框架中使用 OAuth 2 身份验证。现在我使用的 grant_type 值为 password。如果我使用不同的东西,它会抛出unsupported_grant_type。我想知
我正在使用 Spring Oauth 2 来保护 Web 应用程序并实现三足安全系统,以及在使用时 grant_type=密码 我注意到用于获取用户 token 的 URL 是: Method : P
我是 OAuth2 概念的新手。我必须在我的应用程序中实现它。此应用程序提供 REST API。我遵循了一些教程,做了一些研究,并在我的应用程序中以工作状态实现了它。 但在进行一些搜索时,我读到了 O
我是一名优秀的程序员,十分优秀!