# "Set up Passport" -Advanced Node.js Error

**URL:** <https://forum.freecodecamp.org/t/set-up-passport-advanced-node-js-error/453955>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [April 1, 2021, 2:17pm UTC](https://forum.freecodecamp.org/t/set-up-passport-advanced-node-js-error/453955 "2021-04-01T14:17:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dthompson3423](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@dthompson3423](https://forum.freecodecamp.org/u/dthompson3423)\
**Post date:** [April 1, 2021, 2:17pm UTC](https://forum.freecodecamp.org/t/set-up-passport-advanced-node-js-error/453955/1 "2021-04-01T14:17:16Z")

</div>

**Tell us what’s happening:**

So I’ve been working on this project through repl but cant get the correct solution. My code on my server.js file is exactly the same as this [Advanced Node and Express - Set up Passport · GitHub](https://gist.github.com/camperbot/4068a7662a2f9f5d5011074397d6788c), I’ve imported and required both passport and express-session, and Ive set the ‘SESSION\_SECRET’ in my env file. From what I understand that should be enough to solve the challenge but for some reason I get the following error when I try and run the server. Would anyone have any guidance as to where to go from here?

 ![Screen Shot 2021-04-01 at 10.11.19 AM](https://global.discourse-cdn.com/freecodecamp/original/3X/4/7/47434caa4f6835a0da16fb99e21b7baf83d9403e.png)

**Your code so far**

**Your browser information:**

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36`.

**Challenge:** Set up Passport

**Link to the challenge:**

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/quality-assurance/advanced-node-and-express/set-up-passport)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![Sky020](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/sky020/32/128093_2.png) [@Sky020](https://forum.freecodecamp.org/u/Sky020)\
**Post date:** [April 1, 2021, 2:24pm UTC](https://forum.freecodecamp.org/t/set-up-passport-advanced-node-js-error/453955/2 "2021-04-01T14:24:19Z")

</div>

Welcome there,

Without seeing your code, it is impossible to tell. Would you mind sharing the link to your code?

Have you debugged whether the value of `process.env.SESSION_SECRET` is correct (not `undefined`)?

---

<div class="post-metadata">

**Author:** ![dthompson3423](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@dthompson3423](https://forum.freecodecamp.org/u/dthompson3423)\
**Post date:** [April 1, 2021, 2:30pm UTC](https://forum.freecodecamp.org/t/set-up-passport-advanced-node-js-error/453955/3 "2021-04-01T14:30:24Z")

</div>

> **[Invitation to collaborate on boilerplate-advancednode-2-referbishe](https://replit.com/login?goto=%2Fjoin%2Fxmkdnpav-dthompson3423)**
>
> Code together live on boilerplate-advancednode-2-referbishe, a Node.js by dthompson3423, with Repl.it multiplayer

here is the link to my repl project - I appreciate your help!

---

<div class="post-metadata">

**Author:** ![Sky020](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/sky020/32/128093_2.png) [@Sky020](https://forum.freecodecamp.org/u/Sky020)\
**Post date:** [April 1, 2021, 4:57pm UTC](https://forum.freecodecamp.org/t/set-up-passport-advanced-node-js-error/453955/4 "2021-04-01T16:57:37Z")

</div>

There seems to be a misunderstanding about the `.env` file.

All I did to get past the error is create a `.env` file, and add `SESSION_SECRET=someval` to it. If you are unaware of how `.env` files work, I recommend these resources:

- [https://www.freecodecamp.org/learn/apis-and-microservices/#basic-node-and-express](https://www.freecodecamp.org/learn/apis-and-microservices/#basic-node-and-express)
- [How to Use Environment Variables the Right Way](https://www.freecodecamp.org/news/using-environment-variables-the-right-way/)

If you have any specific questions, feel free to ask them. (P.S. I have deleted the `.env` file in your project, so you can go through the steps to create)

Hope this helps

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [October 1, 2021, 4:57am UTC](https://forum.freecodecamp.org/t/set-up-passport-advanced-node-js-error/453955/5 "2021-10-01T04:57:47Z")

</div>

Closed on October 1, 2021, 4:57am UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
