Build and Understand a Simple Node.js Website with User Authentication

Build and Understand a Simple Node.js Website with User Authentication

Learn how to build and understand authentication in Node.js websites in this in-depth post.

Hasan Al Khaled

Hi, I have followed exactly as you have instructed. But unfortunately getting this error -> “Error: Your appBaseUrl is missing.”. Can you please assist?

Matt Raible

We released a new version of oidc-middleware (Express) package in February:…

This is a new major version which does include breaking changes, including this new appBaseUrl parameter.

If you use the version of oidc-middleware specified in this post, everything should work as expected.

npm install express-session@1.15.6
npm install @okta/oidc-middleware@0.1.3
npm install @okta/okta-sdk-nodejs@1.1.0


Within your app.js file, in the ‘oidc’ variable, under client secret, insert <code>appBaseUrl: http://localhost:3000,</code> or whatever host you are developing on. This should fix that error.

Ivan Alejandro Escobar Broitma

How can i deploy to an apache webserver?

Matt Raible

I’d suggest searching google for how to integrate the two.

baha haaba

Hi this work well, but is it possible to get it render another url thats stored in user.profileUrl?
at the moment I called userprofile url but I receive it as txt… I know I can add href but I want to be loaded automaticly inside /dashboard

Matt Raible

You don’t be able to have the redirect URI be from the user’s profile since you have to whitelist those in your application’s OIDC settings on Okta. However, there’s nothing stopping you from creating a custom callback component that reads the user’s information and redirects to somewhere else. By default, you’re redirected back to where the user started from.

Souvik Ghosh


Nice article… Is there any write up on how to host this in Google Cloud platform?

Thanks in advance.