When asking for help in this category, please make sure to provide the following details:
- SDK Version: ^3.1.0
- Platform: NodeJS
- Browser Console Screenshots:
- If the issue is related to Custom Authentication, please include the following information (optional):
- Verifier Name: w3a-key
- JWKS Endpoint: https://staging-ws.origos.io/.well-known/jwks.json
- Sample idToken (JWT):
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImNiZmU0YTc4LTkxNzEtNDMwMy04ODRkLWFmMmQ1MDI0YmZlNyJ9.eyJ1c2VySWQiOiJmMzhiNTg5ZS05Y2I5LTRjYWMtODA5Yy05MmI1NGVhMjRkNzEiLCJhdWQiOiJCTHFyQUI1MmU2RmUySE1SWC12NVVqVjZxWFR3bHgxVHBvVDFMQW01Mk1kX08wU1RfNVA3QmxYZjdBVmZmVlNvNUJYRTZ6UjVLSlVSU1FpZ3Z3UGRtWGsiLCJpc3MiOiJodHRwczovL2FwaS1hdXRoLndlYjNhdXRoLmlvIiwibmFtZSI6ImFwaS13ZWIzYXV0aCIsImlhdCI6MTcwNjU2ODgxNSwiZXhwIjoxNzA2NTcyNDE1LCJ3YWxsZXRzIjpbeyJ0eXBlIjoidzNhLWtleSIsImFkZHJlc3MiOiIweGI2YTdkYWZlMDA2YzM4OTU4Y2Y1NmZjNmQ4MzU2YWFiMTFmYjY1ZjAifV19.rPOSaxIhOn_yJ0BlupRY1WWi834EM4GtLS_r6tVO7-RCYgoGzMLDV6ZisCl22KixgfdPYKJJnAo7J1WOnmYSHNM6m7-ZfFTfqCQ4joDW6m8n6tuG5WSxzmMei54Jp7px8l-L0JMmd7aczDHHCxHEYeKCBHTpeV4s1aV3p7pCXVGF_tnuIT_JH2xaZcguzgLajytoZd-DfFmF2aS6EX6AT24F9yHtaay6X6G6grkyJjYfbfmEoWhZwZkcm6Yf8kvB09JIYnTDmyhPDz_mL2KjfNQilGhE4608LlFMv6S8t9t717yRDZ3GrgOU_C0gs4tG4jZpOc4jHLBPgnrs3c99ew
Also, kindly provide the Web3Auth initialization and login code snippet below. This will help us better understand your issue and provide you with the necessary assistance.
const { Web3Auth } = require(“@web3auth/node-sdk”);
const { EthereumPrivateKeyProvider } = require(“@web3auth/ethereum-provider”);
const jwt = require(‘jsonwebtoken’);
const fs = require(‘fs’);
const clientId = “BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ”; // Get your Client ID from Web3Auth Dashboard
const verifier = “w3a-node-demo”;
const web3auth = new Web3Auth({
clientId,
web3AuthNetwork: “sapphire_mainnet”, // Get your Network ID from Web3Auth Dashboard
});
const ethereumProvider = new EthereumPrivateKeyProvider({
config: {
chainConfig: {
chainId: “0x1”,
rpcTarget: “https://rpc.ankr.com/eth”
}
}
});
web3auth.init({ provider: ethereumProvider });
var privateKey = fs.readFileSync(‘privateKey.pem’);
var sub = Math.random().toString(36).substring(7);
var token = jwt.sign(
{
sub: sub,
name: ‘Agrawal Alam Mishra Rawski Bherwani’,
email: ‘devrel@web3auth.io’,
aud: ‘urn:api-web3auth-io’,
iss: ‘https://web3auth.io’,
iat: Math.floor(Date.now() / 1000),
exp: Math.floor(Date.now() / 1000) + 60 * 60,
},
privateKey,
{ algorithm: ‘RS256’, keyid: ‘2ma4enu1kdvw5bo9xsfpi3gcjzrt6q78yl0h’ },
);
const connect = async () => {
const provider = await web3auth.connect({
verifier: “w3a-node-demo”, // replace with your verifier name
verifierId: sub, // replace with your verifier id’s value, for example, sub value of JWT Token, or email address.
idToken: token, // replace with your newly created unused JWT Token.
});
const eth_private_key = await provider.request({ method: “eth_private_key” });
console.log("ETH PrivateKey: ", eth_private_key);
const eth_address = await provider.request({ method: “eth_accounts” });
console.log("ETH Address: ", eth_address[0]);
process.exit(0);
};
connect();
I need get wallet eth_public_key