# Ability to add custom config in passport.authenticate

**URL:** <https://discourse.nodered.org/t/ability-to-add-custom-config-in-passport-authenticate/35646>\
**Category:** General\
**Created:** [10 November 2020 04:34 UTC](https://discourse.nodered.org/t/ability-to-add-custom-config-in-passport-authenticate/35646 "2020-11-10T04:34:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrinalvirnave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mrinalvirnave/32/31651_2.png) [@mrinalvirnave](https://discourse.nodered.org/u/mrinalvirnave)\
**Post date:** [10 November 2020 04:34 UTC](https://discourse.nodered.org/t/ability-to-add-custom-config-in-passport-authenticate/35646/1 "2020-11-10T04:34:26Z")

</div>

I am using [passport-azure-ad](http://www.passportjs.org/packages/passport-azure-ad/) and have a need to add a "customState" option in the passport.authenticate() function [here](https://github.com/node-red/node-red/blob/master/packages/node_modules/%40node-red/editor-api/lib/auth/index.js#L198) (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.

```auto
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.  
Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [9 January 2021 04:34 UTC](https://discourse.nodered.org/t/ability-to-add-custom-config-in-passport-authenticate/35646/2 "2021-01-09T04:34:28Z")

</div>

Closed on 9 January 2021 04:34 UTC

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