I am trying to implement custom authentication for telegram users using web3auth. I am following this guide https://web3auth.io/docs/auth-provider-setup/byo-jwt-providers
. I created everything but I am getting below error when trying to login the user
{
"errorMsg": "Could not get result from torus nodes \n Error occurred while verifying params json: cannot unmarshal number into Go value of type string",
"errorStack": "Error: Could not get result from torus nodes \n Error occurred while verifying params json: cannot unmarshal number into Go value of type string\n at et (https://auth.web3auth.io/v5/assets/index-b8960750.js:1:1494)\n at https://auth.web3auth.io/v5/assets/index-b8960750.js:1:9553",
"title": "Mount Error",
}
Below is my react code
useEffect(() => {
const init = async () => {
try {
const chainConfig = {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: '0x1',
rpcTarget: 'https://rpc.ankr.com/eth',
displayName: 'Ethereum Mainnet',
blockExplorer: 'https://etherscan.io',
ticker: 'ETH',
tickerName: 'Ethereum',
};
const web3auth = new Web3AuthNoModal({
clientId: clientId,
chainConfig,
web3AuthNetwork: OPENLOGIN_NETWORK.SAPPHIRE_DEVNET,
useCoreKitKey: false,
});
const privateKeyProvider = new EthereumPrivateKeyProvider({ config: { chainConfig } });
const openloginAdapter = new OpenloginAdapter({
adapterSettings: {
uxMode: 'redirect', // redirect or popup
whiteLabel: {
appName: 'Test',
appUrl: 'https://web3auth.io',
defaultLanguage: 'en',
mode: 'light',
theme: {
primary: 'blue',
},
useLogoLoader: true,
},
loginConfig: {
jwt: {
verifier: 'telegram-bot-3',
typeOfLogin: 'jwt',
clientId: clientId,
},
},
},
privateKeyProvider,
});
web3auth.configureAdapter(openloginAdapter);
setWeb3auth(web3auth);
await web3auth.init();
} catch (error) {
console.error(error);
}
};
init();
const urlToken = getTokenFromUrl();
if (urlToken) {
setToken(urlToken);
}
}, []);
await web3auth.connectTo(WALLET_ADAPTERS.OPENLOGIN, {
loginProvider: 'jwt',
extraLoginOptions: {
id_token: token,
verifierIdField: 'sub',
},
});
here is how I am generating the token:
const now = Math.floor(Date.now() / 1000);
const token = jwt.sign(
{
sub: userId,
email: userEmail,
aud: 'urn:my-resource-server',
iss: 'https://payments.sandbox.zoksh.com',
iat: now - 30,
exp: now + 60 * 60, // Token valid for 1 hour
},
PRIVATE_PEM_KEY,
{ algorithm: 'RS256', keyid: KEY_ID }
);
How to solve the error? Is there anything which I am missing?