I'm implementing the OAuth2 resource owner password credentials grant with Passport.js and the oauth2-client-password strategy for an API, but I'm confused as to what the client_id and client_scret are supposed to be? The specs for the resource owner password credentials grant say:
The client makes a request to the token endpoint by adding the following parameters using the "application/x-www-form-urlencoded" format per Appendix B with a character encoding of UTF-8 in the HTTP request entity-body:
grant_type
REQUIRED. Value MUST be set to "password".
username
REQUIRED. The resource owner username.
password
REQUIRED. The resource owner password.
scope
OPTIONAL. The scope of the access request as described by Section 3.3.
But the Passport.js strategy is documented to be used like this:
passport.use(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.clientSecret != clientSecret) { return done(null, false); }
return done(null, client);
});
}
));
So my question is, if the specs don't say anything about the client_id or client_secret being required, why is the oauth2-client-password strategy using the client_id and secret_id?