Certain grant types have specific functions that must be implemented for them to work. The Client Credentials grant type must have the getUserFromClient() function implemented to be used.

The getUserFromClient() function is invoked to retrieve the user associated with the specified client. We are not using a user in our application so we can return an empty object. However, leaving out this function declaration will throw an error when using the Client Credentials grant type!

const getUserFromClient = (client) => { return {}; }

Finally, we export the function from model.js so that it can be used from other files. We can do this using module.exports object.

module.exports = { // Other modules to export getUserFromClient: getUserFromClient }



Within model.js define a function expression named getUserFromClient() that takes one argument, client using ES6 Arrow function expressions.


Return an empty object from the getUserFromClient() function.


We’ll have to export the function from model.js using the module.exports object. Export getUserFromClient() as getUserFromClient.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?