(Disclaimer: I am not familiar with Coa, but I am with Express and Passport.)
I looked at the link you provided, and here is how they use the kao general passport session.
In the server.js file , the following lines relate to the configuration of the passport.
08 - const passport = require("koa-passport"); 13 - const config = require("./config/config"); 38 - require("./config/passport")(passport, config); 40 - require("./config/koa")(app, config, passport);
Line 38 is a traditional passport configuration file that simply sets serialization and deserialization.
Line 40 includes koa.js and passes the application, configuration file, and passport files to it.
The following code from koa.js:
04 - const session = require("koa-generic-session"); 18 - app.keys = config.app.keys;
Looking at koa.js, koa-generic-session is assigned to a session variable. This variable is then called here:
35 - app.use(session({ 36 - key: "koareactfullexample.sid", 37 - store: new MongoStore({ url: config.mongo.url }), 38 - }));
On line 18, app.keys initialized as documentation for the koa-generic-session . While your project uses MongoStore with koa-generic-session, you can simply replace this constructor with the koa-redis constructor, as shown in the koa- generic-session .
Finally, the passport is initialized:
41 - app.use(passport.initialize()); 42 - app.use(passport.session());
This code is similar to using Passport with Express, since all Passport must manage session authentication.