Ability to add custom config in passport.authenticate

I am using passport-azure-ad and have a need to add a "customState" option in the passport.authenticate() function here (and line 207)

I can do it by just adding the customState option in the object as below in my own fork,
passport.authenticate(strategy.name, {session:false, failureRedirect: settings.httpAdminRoot, customState:options.customState }),

but I think there is a more elegant way of allowing a setting which takes an object to be merged into
{session:false, failureRedirect: settings.httpAdminRoot }

So in my case I would add something like the following in my adminAuth in settings.js to make it work.

adminAuth: {
    strategy: {
        options: {
          callbackMethod: "post",
          authenticateOptions: { customState: "xxxxx" },

I believe this would be immensely helpful for those implementing various OIDC/OAuth (example Google or Microsoft based) strategies with different options.

Please share comments or opinions. I may try to implement this and make it my first contribution to the project.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.