tKey sdk in chrome extension: unexpected redirect to redirect_uri page instead of returning the user details after successful auth

Please provide the following details too when asking for help in this category:

  • SDK Version: 7.3.0
  • Verifier Details:
    • Verifier Name: 9-google-pluser
    • JWKS Endpoint: ~
    • Sample idToken(JWT): ~

Hello!

I’m trying to integrate the tKey sdk to chrome extension and using the authentication via google.
What works fine:

  • tKey initializes with the passed config
  • the google authentication window opens
  • i see the correct information about the app on this page
  • i click the google account

What happens next:

  • i’m redirected to baseUrl/redirectPathName page

The problem

Despite the option “redirectToOpener” is passed, I still get the redirect to baseUtl/redirectPathName after the successful authentication via google.

Expected: the google auth page closes and the called tKey.serviceProvider.triggerLogin() returns the user details (jwt token, etc) as it does with usual web-page (not chrome extension) popup-flow.

Question

How to get the expected behavior?


P.S

I’ve rapidly gone through the tKey js sdk source code, and inside the class CaustomAuth {} there is a line

so, I’m afraid, it’s impossible to skip the redirect. Is it true?


Also, I’ve inspected how the Binance Wallet extension, which is using web3auth, works, and - that’s a strange part - after authentication via google they manually create the the new Popup with their extension. This also makes me think that they get redirect, then immediately call window.close() and show a new popup via tabs.create() API.
This isn’t nice, however acceptable.

I could also go this way if there are no others left.
The question is: how to pass the data after authenticated, that I will receive in the redirected page, to the tKey sdk used in chrome extension?


Please, let me know if I could give any other details to help with solving this


Here is my configuration, pls, pay attention to the comments.

const authArgs = {
  baseUrl: "http://localhost:3000", // I was trying *not* to pass this, however tKey fails without it.
  redirectPathName: "redirect", 
  redirectToOpener: true, // I hoped this will disable the redirect and will use the callback techincks insted - as it's described in google identity service for creating Popups
  enableLogging: true,
  network: "cyan"
};
//
//
const webStorageModule = new ChromeExtensionStorageModule();
const securityQuestionsModule = new SecurityQuestionsModule();

// Instantiation of tKey
export const tKey = new ThresholdKey({
  modules: {
    chromeStorage: webStorageModule,
    securityQuestions: securityQuestionsModule
  },
  customAuthArgs: authArgs as any
});