I am using the tKey SDK with a Custom verifier (JWT based with Auth0). In the docs, the initialization of the TorusServiceProvider requires customAuthArgs in which a baseUrl is required for a service worker. Why is this required? Because a user is already authenticated when we call triggerLogin() with their JWT, we don’t do any auth redirects (and we use ‘skipSw: true’, see code below). Is there something else this URL / service worker is doing where it is necessary at some point?
To be clear, the integration code below is working for the social login, I am just trying to solidify my understanding of the ServiceProvider configuration and service worker.
const oidcLogin = async () => {
if (!tKey) {
console.log('tKey not initialized yet');
return;
}
// Initialization of Service Provider
try {
await (tKey.serviceProvider as any).init({ skipSw: true });
} catch (error) {
console.error(error);
}
try {
// Triggering Login using Service Provider
const claims = await getIdTokenClaims();
const idToken = claims?.__raw;
const jwtParams = {
id_token: idToken,
verifierIdField: 'sub',
};
const loginResponse = await (tKey.serviceProvider as any).triggerLogin({
typeOfLogin: 'jwt',
verifier: 'mural-auth0-tkey',
clientId: CLIENT_ID,
jwtParams: jwtParams,
});
setWeb3AuthUser(loginResponse.userInfo);
} catch (error) {
console.error('got an error when calling triggerLogin: ', error);
}
};