Skip to content

Commit 6500d76

Browse files
authored
feat(passport): Add extra params support when init passport in the game bridge (#2626)
1 parent ae356ba commit 6500d76

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/game-bridge/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const initRequest = 'init';
6868
const initRequestId = '1';
6969

7070
let passportClient: passport.Passport | null;
71+
let passportInitData: string | null = null;
7172
let providerInstance: provider.IMXProvider | null;
7273
let zkEvmProviderInstance: passport.Provider | null;
7374
let versionInfo: VersionInfo | null;
@@ -222,7 +223,8 @@ window.callFunction = async (jsonData: string) => {
222223
const request = JSON.parse(data);
223224
const redirect: string | null = request?.redirectUri;
224225
const logoutMode: 'silent' | 'redirect' = request?.isSilentLogout === true ? 'silent' : 'redirect';
225-
if (!passportClient) {
226+
if (!passportClient || passportInitData !== data) {
227+
passportInitData = data;
226228
console.log(`Connecting to ${request.environment} environment`);
227229

228230
let passportConfig: passport.PassportModuleConfiguration;
@@ -242,6 +244,7 @@ window.callFunction = async (jsonData: string) => {
242244
scope,
243245
crossSdkBridgeEnabled: true,
244246
logoutMode,
247+
extraQueryParams: request.extraQueryParams,
245248
overrides: {
246249
authenticationDomain: 'https://auth.dev.immutable.com',
247250
magicPublishableApiKey: 'pk_live_4058236363130CA9', // Public key
@@ -277,6 +280,7 @@ window.callFunction = async (jsonData: string) => {
277280
crossSdkBridgeEnabled: true,
278281
jsonRpcReferrer: 'http://imtblgamesdk.local',
279282
logoutMode,
283+
extraQueryParams: request.extraQueryParams,
280284
};
281285
}
282286

0 commit comments

Comments
 (0)