tests: organization and invitation params
Signed-off-by: Jack Palmer <jackpalmer@spotify.com>
This commit is contained in:
@@ -54,7 +54,9 @@ describe('authModuleAuth0Provider', () => {
|
||||
|
||||
const agent = request.agent(server);
|
||||
|
||||
const res = await agent.get('/api/auth/auth0/start?env=development');
|
||||
const res = await agent.get(
|
||||
'/api/auth/auth0/start?env=development&organization=foo-organization&invitation=foo-invitation',
|
||||
);
|
||||
|
||||
expect(res.status).toEqual(302);
|
||||
|
||||
@@ -78,6 +80,8 @@ describe('authModuleAuth0Provider', () => {
|
||||
accessType: 'offline',
|
||||
connection: 'connection',
|
||||
connection_scope: 'connectionScope',
|
||||
organization: 'foo-organization',
|
||||
invitation: 'foo-invitation',
|
||||
nonce: expect.any(String),
|
||||
state: expect.any(String),
|
||||
});
|
||||
|
||||
@@ -49,10 +49,12 @@ export class Auth0Strategy extends Auth0InternalStrategy {
|
||||
}
|
||||
|
||||
authenticate(req: express.Request, options: Record<string, any>): void {
|
||||
const { organization, invitation } = req.query;
|
||||
|
||||
super.authenticate(req, {
|
||||
...options,
|
||||
organization: req.query.organization,
|
||||
invitation: req.query.invitation,
|
||||
...(organization ? { organization } : {}),
|
||||
...(invitation ? { invitation } : {}),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user