Error trying to run sample code


Do have a example of this code sample?

Each time I try to run the code locally I get the following error:

Uncaught TypeError: Router.use() requires a middleware function but got a Object
Process exited with code 1

I added the users.js file to my routes directory. I have the following code inside of the users.js

const express = require('express');
const { PermissionMiddlewareCreator } = require('forest-express-sequelize');

const router = express.Router();
const permissionMiddlewareCreator = new PermissionMiddlewareCreator('users');

// Create a User'/user', permissionMiddlewareCreator.create(), (request, response, next) => {

  // TODO check if user already exist in our system
  // TODO make an api request to create the user in our system


I have a website that uses auth0 to sign in. I want my website adminstrators to be able to sign in to the forestadmin without having to create a new account (or user name and password).

So as an alterlative, I will send them an invite to forest admin (through the admin). And once they sign into the admin, I want create their account on my system.

  • Express Version: ~4.16.3
  • Sequelize Version: ~5.15.1
  • Database Dialect: mysql
  • Database Version: mysq1 8
  • Project Name: theCXN Development

Hello @james-janetech,

Thank you for sharing your issue with us!

When is the reported error raised exactly? When running your admin backend or when calling the /user route?

The error happens on startup.

@james-janetech, this error happens because you have no users model defined.

What the woodshop post you shared helps you setup is to override the create method of an already existing users collection to create or link the created user to one on your API side.

This would help you perform action from another API that requires OAuth. But it does not replace the need for ForestAdmin account to use the AdminPanel.

I found the error, I was missing the module.exports = router; line at the bottom. (Stupid me)

With that said, I’m not trying to replace the need for the forest admin account to use the admin panel.

I just want to know if this example will allow me to call my external APIs after a user signs up via the forest-admin invitation link?

What’s the tech support email for Starter plan customers? I could not find it on the site.

Hello @james-janetech,

Thanks for your messages :slightly_smiling_face:

You are at the right place to reach out the tech support for Starter plans.

I just want to know if this example will allow me to call my external APIs after a user signs up via the forest-admin invitation link?

You can find some additional information about overriding routes on that link as well.

Let me know if something’s still unclear.

@adriguy, I’m not trying to override the routes. I thought the workshop document was linked to admin users signing in and out of forest admin.

I’m trying to get around the lack of single sign-on.

Currently, I’m trying to test the forest-admin with a couple of our clients. The only issue we have our own sign in and you guys have yours. As a result, our clients would need to sign up and create a password for forest admin and our website.

Do you guys have any callback/webhooks for when users accept invite invitations?

Here’s what I am thinking:

  1. I add a user to the admin from the forest-admin portal.
  2. User clicks on the invite link from their email
  3. User signs up with email and password
  4. Forest admin calls webhook sending the email, password, DateTime stamp encrypted using the forest secret env key.
  5. Finally, I create their account on my server, they are able to sign in and out of both system w/ the same password


Actually, our team is currently working on the feature you want: in a few months, you will be able to set a SSO with the SAML protocol.

For now, I’m afraid there is no possible workaround.

Still, I am forwarding your request to our team so that it will be added to the list of our clients needing this feature!