react
August 28, 2023, 1:26pm
1
const login = useCallback(async () => {
try {
const clientId =
"BOUn3gnRgUBl8j-C6PjOoSqv87bU2NnNeYtXNV-3NuXY6OLuiiAC4STtBAexzXkLQv8jauiBubvWzqH_PbmMVrk";
const chainConfig = {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: "0x1",
rpcTarget:
"https://eth.getblock.io/ba715440-9e0d-4ccd-971f-76775c05d886/mainnet/",
displayName: "Ethereum Mainnet",
blockExplorer: "https://etherscan.io",
ticker: "ETH",
tickerName: "Ethereum",
};
const web3auth = new Web3AuthNoModal({
clientId,
chainConfig,
web3AuthNetwork: "mainnet",
useCoreKitKey: false,
});
const privateKeyProvider = new EthereumPrivateKeyProvider({
config: { chainConfig },
});
const openloginAdapter = new OpenloginAdapter({
adapterSettings: {
uxMode: "redirect",
loginConfig: {
jwt: {
verifier: "Mesmrlab-auth-verifier",
typeOfLogin: "jwt",
clientId,
},
},
},
privateKeyProvider,
web3AuthNetwork: "mainnet",
});
web3auth.configureAdapter(openloginAdapter);
await web3auth.init();
const { data } = await axios.post(
"http://localhost:3000/api/v1/auth/web3-login",
{
clientId: "3dd413ba-a90b-4eeb-9178-bdbec9cc8a71",
userId: "640689bf-6b74-42ef-a43a-ffaa6abeffec",
}
);
await web3auth.connectTo(WALLET_ADAPTERS.OPENLOGIN, {
loginProvider: "jwt",
extraLoginOptions: {
id_token: data.data.accessToken,
verifierIdField: "sub", // sub, email, or custom
},
});
} catch (error) {
console.log(error);
}
}, []);
I am not sure what is wrong i am doing? can you please guide me?
Thank you
vjgee
August 28, 2023, 5:41pm
2
@react Welcome Aboard!
Have you setup a Custom verifier in your Dashboard instead of Default Verifier? Is the network for the verifier also MAINNET on the Dashboard and is it Live?
react
August 28, 2023, 5:55pm
3
Hi @vjgee
Yes i have done setup in Dashboard.
Please check attached screenshots and let me know if i have done anything wrong.
Thank you
vjgee
August 28, 2023, 5:57pm
4
Thanks for confirming!
I have forwarded your issue to our Dev team and you will receive further updates.
react
August 28, 2023, 6:07pm
5
Thank you @vjgee
I’m eager to receive your reply
react
August 31, 2023, 5:18am
6
Hey @vjgee
Have you found any solution or not?
vjgee
September 2, 2023, 4:03am
7
@react Your issue was already forwarded to our Dev team. I will get back to you by Monday with an update. In the meantime, please ensure you are on the latest version of the SDK.
react
September 4, 2023, 5:47am
8
@vjgee
I am using latest version of the SDK.
"dependencies": {
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.2.1",
"@types/jest": "^27.0.1",
"@types/node": "^16.7.13",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@walletconnect/qrcode-modal": "^1.8.0",
"@walletconnect/sign-client": "^2.10.0",
"@web3auth/base": "^6.1.7",
"@web3auth/base-provider": "^6.1.7",
"@web3auth/ethereum-provider": "^6.1.7",
"@web3auth/modal": "^6.1.7",
"@web3auth/no-modal": "^6.1.7",
"@web3auth/openlogin-adapter": "^6.1.7",
"@web3auth/solana-provider": "^6.1.7",
"axios": "^1.4.0",
"react": "^18.2.0",
"react-app-rewired": "^2.2.1",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"typescript": "^4.4.2",
"web-vitals": "^2.1.0",
"web3": "^4.1.1"
}
Hi @react , The verifier you have shown is created on Sapphire Mainnet which is different than Mainnet. Sapphire Mainnet works only for MPC for now. Please re-create a new verifier on Cyan Mainnet and give the web3AuthNetwork
as cyan with the new verifier name.
react
September 6, 2023, 9:12am
10
Hi @maharshi
Can you know me how can i use Sapphire Mainnet?
1 Like
It’ll be made available for users of PnP SDKs. for now I’ll advise you to use cyan mainnet.
react
September 6, 2023, 9:27am
12
Does cyan mainnet work world wide users?
1 Like
All our networks work for users all over the world. You are fine with using Cyan.
react
September 6, 2023, 9:41am
14
Then what is mean of “Ideal for apps near the USA”?
1 Like
These networks are hosted nodes In some or the other availability zones located in some geographical region. The places geographically closest to the nodes will receive the lowest latency, hence the ideal for USA. But you needn’t worry, this will work well anywhere on the globe.