Hello, since I updated my openlogin-adapter from v4 to v5, I’ve been getting this error message with my custom JWT connection: “Unexpected token ‘I’, “Invalid en”… is not valid JSON”.
- SDK Version: 7.0.1
- Platform: Chrome Version 117.0.5938.92 (Build officiel) (64 bits)
- Browser Console Screenshots:
- JWT token : {
“sub”: “d6f3adef-27fb-4ad6-80fd-b4d0f7811471”,
“id”: 96,
“username”: “KFMroot”,
“email”: “e@mail.com”,
“role”: “ADMIN”,
“email_verified”: true,
“aud”: “https://website.com”,
“iss”: “https://website.com”,
“iat”: 1696240273,
“exp”: 1696243873
}
import { Web3AuthNoModal } from "@web3auth/no-modal";
import { CHAIN_NAMESPACES } from '@web3auth/base';
import { OpenloginAdapter } from '@web3auth/openlogin-adapter';
import { CLIENT_ID } from 'config';
import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider";
const chainConfig = {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: '0x13881',
displayName: "Polygon Mumbai Testnet",
blockExplorer: "https://mumbai.polygonscan.com/",
ticker: "MATIC",
tickerName: "Matic",
rpcTarget: 'https://polygon-mumbai.g.alchemy.com/v2/{key}'
}
export const Web3auth = new Web3AuthNoModal({
clientId: CLIENT_ID,
chainConfig,
web3AuthNetwork: "legacy_mainnet",
useCoreKitKey: false,
});
const isMobile = /iPhone|iPad|iPod|Android/i.test(window.navigator.userAgent);
const privateKeyProvider = new EthereumPrivateKeyProvider({ config: { chainConfig } });
export const openloginAdapter = new OpenloginAdapter({
chainConfig,
adapterSettings: {
clientId: CLIENT_ID,
web3AuthNetwork: "legacy_mainnet",
uxMode: isMobile ? "redirect" : "popup", // Conditionally set uxMode based on mobile detection
loginConfig: {
jwt: {
verifier: 'verifier_name',
typeOfLogin: 'jwt',
clientId: CLIENT_ID,
},
},
},
privateKeyProvider,
});
Web3auth.configureAdapter(openloginAdapter);