How to set up Passport in an Adonos project?

'm working on an Adonis project and I’m trying to implement authentication using Passport. There are many examples on how to use it with express, but I can’t configure it for Adonis.

I mostly understand what the code does, but the Adonis project is structured a bit differently. I don’t understand where I need to pass the passport object, the return of passport.session() and so on, because there is no app object in my code. Is there a way to retrieve this object or where should I place my code?

app.use(session({ secret: 'anything' })); // session secret
app.use(passport.session()); // persistent login sessions
app.use(flash()); // use connect-flash for flash messages stored in session

// routes ======================================================================
require('./app/routes.js')(app, passport); // load our routes and pass in our app and fully configured passport

@p.costa11 Hi!

Adonis already supports social auth

@Melchyore Thank you for your reply. I’m trying to authenticate using my university account which uses Shibboleth authentication, so I don’t think Ally can do this

Take a look at this and try to add your own driver as Service Provider.

@ Melchyore: Thanks for your help but I have no idea how to add my own driver and what I’m supposed to override

Look at the Twitch driver inside Drivers dir and how it’s implemented inside ServiceProvider.js
You can read more about Service providers here.
Also, you need to know how Shibboleth handles authentication, so read their docs.
Good luck!