diff --git a/plugins/auth-backend/src/lib/OAuthProvider.test.ts b/plugins/auth-backend/src/lib/OAuthProvider.test.ts index 3a211e7b95..bb261d1380 100644 --- a/plugins/auth-backend/src/lib/OAuthProvider.test.ts +++ b/plugins/auth-backend/src/lib/OAuthProvider.test.ts @@ -217,11 +217,10 @@ describe('OAuthProvider', () => { }); it('sets the refresh cookie if refresh is enabled', async () => { - oAuthProviderOptions.disableRefresh = false; - const oauthProvider = new OAuthProvider( - providerInstance, - oAuthProviderOptions, - ); + const oauthProvider = new OAuthProvider(providerInstance, { + ...oAuthProviderOptions, + disableRefresh: false, + }); const mockRequest = ({ cookies: { @@ -251,11 +250,10 @@ describe('OAuthProvider', () => { }); it('does not set the refresh cookie if refresh is disabled', async () => { - oAuthProviderOptions.disableRefresh = true; - const oauthProvider = new OAuthProvider( - providerInstance, - oAuthProviderOptions, - ); + const oauthProvider = new OAuthProvider(providerInstance, { + ...oAuthProviderOptions, + disableRefresh: true, + }); const mockRequest = ({ cookies: { @@ -277,11 +275,10 @@ describe('OAuthProvider', () => { }); it('removes refresh cookie when logging out', async () => { - oAuthProviderOptions.disableRefresh = false; - const oauthProvider = new OAuthProvider( - providerInstance, - oAuthProviderOptions, - ); + const oauthProvider = new OAuthProvider(providerInstance, { + ...oAuthProviderOptions, + disableRefresh: false, + }); const mockRequest = ({ header: () => 'XMLHttpRequest', @@ -303,10 +300,10 @@ describe('OAuthProvider', () => { it('gets new access-token when refreshing', async () => { oAuthProviderOptions.disableRefresh = false; - const oauthProvider = new OAuthProvider( - providerInstance, - oAuthProviderOptions, - ); + const oauthProvider = new OAuthProvider(providerInstance, { + ...oAuthProviderOptions, + disableRefresh: false, + }); const mockRequest = ({ header: () => 'XMLHttpRequest', @@ -330,11 +327,10 @@ describe('OAuthProvider', () => { }); it('handles refresh without capabilities', async () => { - oAuthProviderOptions.disableRefresh = true; - const oauthProvider = new OAuthProvider( - providerInstance, - oAuthProviderOptions, - ); + const oauthProvider = new OAuthProvider(providerInstance, { + ...oAuthProviderOptions, + disableRefresh: true, + }); const mockRequest = ({ header: () => 'XMLHttpRequest', diff --git a/plugins/auth-backend/src/providers/github/provider.ts b/plugins/auth-backend/src/providers/github/provider.ts index aa96b0f38b..0f8f185015 100644 --- a/plugins/auth-backend/src/providers/github/provider.ts +++ b/plugins/auth-backend/src/providers/github/provider.ts @@ -75,7 +75,7 @@ export function createGithubProvider( for (const [env, envConfig] of Object.entries(providerConfig)) { const config = (envConfig as unknown) as OAuthProviderConfig; const { secure, appOrigin } = config; - const callbackURLParam = env === 'development' ? '?env=development' : ''; + const callbackURLParam = `?env=${env}`; const opts = { clientID: config.clientId, clientSecret: config.clientSecret, diff --git a/plugins/auth-backend/src/providers/google/provider.ts b/plugins/auth-backend/src/providers/google/provider.ts index b1d82266fc..971f588dce 100644 --- a/plugins/auth-backend/src/providers/google/provider.ts +++ b/plugins/auth-backend/src/providers/google/provider.ts @@ -122,7 +122,7 @@ export function createGoogleProvider( for (const [env, envConfig] of Object.entries(providerConfig)) { const config = (envConfig as unknown) as OAuthProviderConfig; const { secure, appOrigin } = config; - const callbackURLParam = env === 'development' ? '?env=development' : ''; + const callbackURLParam = `?env=${env}`; const opts = { clientID: config.clientId, clientSecret: config.clientSecret,