Error: Failed to find request token in session
I'll show you one of the causes and how to fix it.
There are many good tutorials on how to set up PassportJS so I will skip on this. Refer to these tutorials on how to setup PassportJS.
- Node Hero - Node.js Authentication using Passport.js - by Gergely Nemeth (@nthgergo)
- passportjs local guide - by Shawn Wang (@swyx)
This is the full error message returned while trying to authenticate with Meetup.
Here is the video of error generated
The error occurred due to Expression Session cookie.secure value.
According to Expression Session documentation setting cookie.secure to true requires an HTTPS enabled site. But it's rarely the case that your development server is HTTPS enabled.
You could set the cookie.secure value to false while developing and set it to true for production by checking process.env.NODE_ENV.
But you can do better by setting cookie.secure value to a non-Boolean value, auto, which will automatically set to true or false depending on the security of current connection.
Running the updated code
Let's update the cookie.secure value to auto and try again.
it works 🎉
I've only discussed one possible cause for "Error: Failed to find request token in session" error message.
There are literally dozens of causes and fixes available when you Google it.