error on the node js code function (initiateLogin not found)

We have tried to integrate web3auth using node js NoModal SDK and I am getting an error on the node js code function (initiateLogin not found) when we try to integrate with the node js route.

SDK Version: “@web3auth/ethereum-provider”: “^8.0.1”,

@web3auth/node-sdk”: “^3.2.0”,

hi @ahana

I hope you are doing well. Please check our examples for PnP no-modal with EVM

You don’t need node-sdk package.

If you can’t find the error please share with me some code snippets so I can help you to solve the issue :slight_smile:

Hi Tom - Thanks for looking into this - I’ve received the below response from my technical team mate for the solution you have provided.

“This is react based application and we want to integrate this in node js SDK. So if you ask him to provide node SDK that would be very helpful for us.”

@ahana please refer this for server side verification

but let us know your requirement and any specific reason for using node js
or try this example if it suits your use case

also go through this guide for choosing the right fit for your requirement

We are trying to not disrupt our onboarding flow. Unfortunately the team says this solution will not work for us. Would it be possible to jump on a call with my team sometime next week. Also, for context, you can try to register to this game to see what we are trying to achieve - https://qz.woof3.xyz/

// web3auth routes
const { Web3Auth } = require('@web3auth/node-sdk');
// Initialize Web3Auth - mayur account web3auth
const web3Auth = new Web3Auth({
    clientId: "BD_i3rLoAmVRaDAtioTvDKRkFU-kxjBoBYvj7Bhcttuxgnjtb0m97Ghcmqx_y4TvwAg60EQHbFFCZQGrFCpxna0", // Get your Client ID from Web3Auth Dashboard
    clientSecret: 'cddef58d2abf1e0d1109c93e471834ba35cfb10a16fd2f0a188b735c70ae6e2f',
    redirectUri: 'http://localhost:4013/web3auth/callback',
});
// Route to initiate authentication and connect wallet
app.get('/web3auth/login', async (req, res) => {
    try {
        // Initiate authentication request
        const authUrl = await web3Auth.initiateLogin();
        // Redirect user to authentication URL
        res.redirect(authUrl);
    } catch (error) {
        res.status(500).send('Error initiating login: ' + error.message);
    }
});

// Callback route after successful authentication
app.get('/web3auth/callback', async (req, res) => {
    try {
        // Complete authentication and connect wallet
        const user = await web3Auth.completeLogin(req.query);
        console.log('user-->>>', user)
        res.send("User response:" + user);
    } catch (error) {
        res.status(500).send('Error completing login: ' + error.message);
    }
});

// Connect wallet route
app.get('/web3auth/connect-wallet', async (req, res) => {
    try {
        // Connect wallet
        const wallet = await web3Auth.connectWallet(req.session.user);
        res.send('Wallet connected successfully: ' + wallet.address);
    } catch (error) {
        res.status(500).send('Error connecting wallet: ' + error.message);
    }
});
// over web3 auth routes

Is this code snippet helpful? We’ve set a call today and hoping to speak with someone from the Tech team to resolve the issue. Cheers!

hi @ahana

Did you test our unity SDK ?

On the other hand maybe these examples can help you in your dApp