# Authentication with OAuth2 and generating custom JWT Token

**URL:** <https://discourse.nodered.org/t/authentication-with-oauth2-and-generating-custom-jwt-token/78365>\
**Category:** General\
**Created:** [11 May 2023 18:03 UTC](https://discourse.nodered.org/t/authentication-with-oauth2-and-generating-custom-jwt-token/78365 "2023-05-11T18:03:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![a\_grunt](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@a\_grunt](https://discourse.nodered.org/u/a_grunt)\
**Post date:** [11 May 2023 18:03 UTC](https://discourse.nodered.org/t/authentication-with-oauth2-and-generating-custom-jwt-token/78365/1 "2023-05-11T18:03:42Z")

</div>

Hi everyone!

Is it possible to generate custom authentication token when authenticating via OAuth protocol?

I tried to implement custom `settings.adminAuth.authenticate()` function, as suggested in [this topic](https://discourse.nodered.org/t/custom-authentication-storing-own-token/59006) , but it doesn't seem to work with `settings.adminAuth.type = 'strategy'`.

What i am trying to achieve is to use multiple Node-Red instances behind Nginx Load Balancer.  
So generating JWT Token after OAuth2 Authentication and later checking it with `settings.adminAuth.tokens` would have been an acceptable solution.

I understand that this setup won't let me use all Node-Red Admin UI features (deploy, debug panel, etc) , but this is fine, because i have separate dev instance , and then `flows.json` is deployed across this self-made 'cluster', so here UI is used mainly for informational purposes.

Thanks in advance!

---

<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:** [10 July 2023 18:04 UTC](https://discourse.nodered.org/t/authentication-with-oauth2-and-generating-custom-jwt-token/78365/2 "2023-07-10T18:04:38Z")

</div>

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