feat: auth0 strategy - set invitation query parameter as authorizationParam when present

Signed-off-by: Jack Palmer <jackpalmer@spotify.com>
This commit is contained in:
Jack Palmer
2026-02-05 13:23:57 +00:00
parent b0c49ebca2
commit 8949803609
2 changed files with 19 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend-module-auth0-provider': minor
---
Set invitation query parameter as authorizationParam when present
@@ -16,6 +16,7 @@
import Auth0InternalStrategy from 'passport-auth0';
import type { StateStore } from 'passport-oauth2';
import type express from 'express';
/** @public */
export interface Auth0StrategyOptionsWithRequest {
@@ -47,15 +48,24 @@ export class Auth0Strategy extends Auth0InternalStrategy {
this.organization = options.organization;
}
authenticate(req: express.Request, options: Record<string, any>): void {
super.authenticate(req, {
...options,
invitation: req.query.invitation?.toString(),
});
}
authorizationParams(options: Record<string, any>): Record<string, any> {
const params = super.authorizationParams(options);
if (this.organization) {
return {
...params,
organization: this.organization,
};
params.organization = this.organization;
}
if (options.invitation) {
params.invitation = options.invitation;
}
return params;
}
}