We plan to migrate our guidance from using Passport in Express web apps to using this new Auth0 Express OIDC SDK. We believe that this new SDK will simplify the implementation of authentication in Express web apps, making it easier for you to secure the user experience.
If you’d like, my recommendation to you would be to give the new Express OIDC SDK a try and see if you still face any issues. If you do, please let us know in the Issues section of that repo, please, so that we can document and tackle them
I can’t find the right place to post this so hopefully this will do… This tutorial is out of date:
Specifically,
getConnectionString() is deprecated so we now use getUri()
the latest version of MongoMemoryServer (v7) has a breaking change compared to the version used in the tutorial. The details can be found here.
But for brevity, the change required is as follows:
// this no longer works
const mongo = new MongoMemoryServer();
const mongoDBURL = await mongo.getConnectionString(); // ERROR: instance not started
// it is now
const mongo = await MongoMemoryServer.create();
const mongoDBURL = mongo.getUri();
Very nice tutorial. I ran into a small issue when following the tutorial as written but was able to easily find the solution.
The tutorial uses req.logOut() in the file auth.js when defining the “/logout” route.
It was giving me the following error: Error: req#logout requires a callback function
Apparently req.logOut() was updated and is no longer synchronous but requires a callback function.
The solution for me was to modify the router definition so that the code after req.logOut(); becomes the callback function:
Thank you for reading this blog post. I am glad that it has been useful to you.
Being frank, I have not looked at this blog post for some time. We are planning on releasing a new code sample and future guide that shows how to secure Express web app using our latest developer toolset.
I recommend using the approach on that complete guide more than that one used in this blog post. The new express-openid-connect library simplifies greatly the authentication implementation in Express.js web apps.
Does your project require the usage of Passport.js?
The authentication solution of this current blog post uses Passport, which I no longer have direct experience with. However, Passport is still an important and widely used library. We can take a look at this code sample next week to determine what is the update path for it How does that sound?
Hello Dan , please i really want to better understand the following , how to secure a login portal for company using passpot.js with Auth0 ? i tried yours but i a little confused and nothing work , it seems that is too advanced . Please if you are more options i will be very happy to learn about that1 another thing i would like you to write like this:
step1:
step2:
step3:
something like that . i would like to learn more
Thanks in advance
Hello! Welcome to the Auth0 Community. You don’t need to use Passport.js any longer! We have a simpler library that makes adding authentication to Express web apps much easier. Please follow this other guide: The Complete Guide to Node.js User Authentication with Auth0
Please let us know if you run into any issues with that guide. Thank you for your interest in securing your users with Auth0.
hello I am running into an issue when I trying to log out I have followed all the steps in the blog in the proper order please let me know what I can do to fix my problem
This is what is happening when I am trying to log out:
Error: req#logout requires a callback function