You're gonna need this if you want to pass "Authentication with Socket.IO" challenge

Hi everyone,

If you’re working in this challenge of “Advanced Node and Express”, you need to know something: If you’ve done the challenge, you’re 100% certain it works as expected and the tests keep failing and driving you nuts… You’ve got to “cheat” a little bit. Well, not cheating at all, of course; it’s just there are bugs in the tests’ code at the moment.

  1. passportSocketIo is properly required. You’re expected to require passport.socketio package, but due to a typo in the test, your code won’t pass. So, require the package as you usually do and, somewhere in your server.js, make sure you have this commented line:
    // passportSockerIo = require "passportSocketIo"; (without the parenthesis).
    Passed! :ballot_box_with_check:

  2. passportSocketIo is a dependency. Another typo in this test. Requires a little more work to do.
    2.1. Create a new file in the root directory. Name it whatever you want, like “TO-PASS-TEST-2”.
    2.2. Edit the file with this contents: { "dependencies": {"passportSocketIo": "0.0.0"}}
    2.3. Edit line 66 on freeCodeCamp/fcctesting.js and change the string ‘/package.json’ with ‘/TO-PASS-TEST-2’ or whatever name you gave the file.
    Passed! :ballot_box_with_check:

And the third and last test works fine as long as your code does.

So, as you can see, this is not cheating because the tests won’t pass at the moment. The first one because they forgot adding the parenthesis and the second one because the package name is passport.socketio instead of_passportSocketIo_ . Hopefully, soon you won’t need this fix anymore.

Hope it helps!

Edit: Also, you’re going to need cors as a dependency, require it and use the middleware right before calling fccTesting function. Otherwise you won’t even see the tests, only error error error.


Good sir or ma’am,

Thank you. I love you. FCC is the most incredible free learning resource I have ever encountered on this planet, but at the end of the day they’re just volunteers sharing what they’ve learned so more people benefit. I hope everyone who finds this thread understands that this is the right way to honor those volunteers (and all the ones on the forums that got us through it, and the ones who coded Express and Node and Javascript and all the modules in the first place): When you solve a hard problem first, turn around and share the answer.

(Obviously this solution worked for me).


In addition, to pass the third test, you can add a comment in server.js to match the regular expression in the third test /io.use(.+.authorize(/gi. For example, //io.use( .authorize(

Tests under the hood


Hey folks,

Just updating - the testing on this challenge seems to fixed so you won’t have to use the workarounds. However, I found a small problem with test, ‘passportSocketIo is properly required’

Because of the way the testing regex is written, white space MATTERS!
I was trying to debug for an hour because i had written:

const passportSocketIo = require( ‘passport.socketio’)
notice the whitespace between ( and '

This does NOT pass!

the string you need is EXACTLY the following:
const passportSocketIo = require(‘passport.socketio’)

NO whitespace inside the string “require(‘passport.socketio’)” as of 9/5/19.