Open
Description
Hello,
Is there any possibility to create a user if not exists?
I think the right place is here:
model.getClient = function (clientId, clientSecret, callback) {
console.log('in getClient (clientId: ' + clientId + ', clientSecret: ' + clientSecret + ')');
if (clientSecret === null) {
return OAuthClientsModel.findOne({ clientId: clientId }, callback);
}
OAuthClientsModel.findOne({ clientId: clientId, clientSecret: clientSecret }, callback);
};
However after reading the documentations/examples and also the codes, I'd like to know can we get some optional headers inside this method for creating a new user, if not already exists? for example:
model.getClient = function (clientId, clientSecret, callback) {
...
// if not a user, and some special headers is set in /oauth/token, then create it
if (clientId === null && req.body.is_Admin && req.body.should_Create && req.body.admin_SomeSecret_For_UserCreation) {
OAuthClientsModel.insert({ clientId: clientId, clientSecret: clientSecret, /* clientDetail: {clientDetail} */ }, callback);
}
};
Is that possible at all?