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

**URL:** <https://devforum.okta.com/t/build-and-understand-a-simple-node-js-website-with-user-authentication/16917>\
**Category:** Developer Blog Comments\
**Created:** [August 16, 2018, 9:27pm UTC](https://devforum.okta.com/t/build-and-understand-a-simple-node-js-website-with-user-authentication/16917 "2018-08-16T21:27:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [August 16, 2018, 9:27pm UTC](https://devforum.okta.com/t/build-and-understand-a-simple-node-js-website-with-user-authentication/16917/1 "2018-08-16T21:27:50Z")

</div>

[Build and Understand a Simple Node.js Website with User Authentication](https://developer.okta.com/blog/2018/08/17/build-and-understand-user-authentication-in-node)

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

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [April 25, 2019, 5:05am UTC](https://devforum.okta.com/t/build-and-understand-a-simple-node-js-website-with-user-authentication/16917/2 "2019-04-25T05:05:44Z")

</div>

**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?

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [April 25, 2019, 11:50am UTC](https://devforum.okta.com/t/build-and-understand-a-simple-node-js-website-with-user-authentication/16917/3 "2019-04-25T11:50:13Z")

</div>

**Matt Raible**

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

[https://github.com/okta/okt…](https://github.com/okta/okta-oidc-js/releases/tag/%40okta%2Foidc-middleware%402.0.0 "https://github.com/okta/okta-oidc-js/releases/tag/%40okta%2Foidc-middleware%402.0.0")

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.6npm install @okta/oidc-middleware@0.1.3npm install @okta/okta-sdk-nodejs@1.1.0
```

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [August 14, 2019, 4:02pm UTC](https://devforum.okta.com/t/build-and-understand-a-simple-node-js-website-with-user-authentication/16917/4 "2019-08-14T16:02:01Z")

</div>

**Mike**

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.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [August 22, 2019, 8:45pm UTC](https://devforum.okta.com/t/build-and-understand-a-simple-node-js-website-with-user-authentication/16917/5 "2019-08-22T20:45:33Z")

</div>

**Ivan Alejandro Escobar Broitma**

How can i deploy to an apache webserver?

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [September 6, 2019, 3:02pm UTC](https://devforum.okta.com/t/build-and-understand-a-simple-node-js-website-with-user-authentication/16917/6 "2019-09-06T15:02:45Z")

</div>

**Matt Raible**

I’d suggest [searching google](https://www.google.com/search?q=apache+%2B+node "https://www.google.com/search?q=apache+%2B+node") for how to integrate the two.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [November 8, 2019, 10:28pm UTC](https://devforum.okta.com/t/build-and-understand-a-simple-node-js-website-with-user-authentication/16917/7 "2019-11-08T22:28:20Z")

</div>

**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

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [November 9, 2019, 11:06am UTC](https://devforum.okta.com/t/build-and-understand-a-simple-node-js-website-with-user-authentication/16917/8 "2019-11-09T11:06:47Z")

</div>

**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.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [June 11, 2020, 5:23am UTC](https://devforum.okta.com/t/build-and-understand-a-simple-node-js-website-with-user-authentication/16917/9 "2020-06-11T05:23:52Z")

</div>

**Souvik Ghosh**

Hello,

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

Thanks in advance.  
Souvik
