In Strapi v4, I tried to setup discord oath provider following the latest-docs. I've setup the keys and everything but when I try to hit /api/connect/discord I'm getting this error
Grant: mount session middleware first
I goggled a bit and found that Strapi need to use grant as a middleware first in order to use it. so I checked /config/middleware.js
module.exports = [
'strapi::errors',
'strapi::security',
'strapi::cors',
'strapi::poweredBy',
'strapi::logger',
'strapi::query',
'strapi::body',
'strapi::favicon',
'strapi::public',
];
it was missing grant so I tried creating a custom global grant middleware but I need to get hold of the app instance and do the following
app.use(session({secret:'grant'));
app.use(grant);
how can I achieve this? or if anyone has any idea to fix the above problem ?