-
I am using web3auth web sdk in WebView on my react native project, and I tried to integrate the predesigned login page in web sdk for my project.
-
In my local server which is handling web3auth web sdk (I get this by CDN), the instance of web3auth object is successfully created as displayed in log, but there is no response and no error message processing these two functions, where the codes are stuck:
await web3auth.initModal(); const provider = await web3auth.connect();
-
This is the codes for my html handling webVIew (cliend id is deleted cuz this is a public post):
Login with Web3Auth
this is the package.json:
{
“name”: “pantheon”,
“version”: “0.0.1”,
“private”: true,
“scripts”: {
“android”: “react-native run-android”,
“ios”: “react-native run-ios”,
“lint”: “eslint .”,
“start”: “react-native start”,
“test”: “jest”,
“server”: “nodemon server.js”,
“build”: “webpack --config webpack.config.js”
},
“dependencies”: {
“@react-navigation/native”: “^6.1.18”,
“@react-navigation/stack”: “^6.4.1”,
“@web3auth/base”: “^8.12.4”,
“@web3auth/ethereum-provider”: “^8.12.4”,
“@web3auth/modal”: “^8.12.7”,
“@web3auth/web3auth”: “^2.1.3”,
“express”: “^4.19.2”,
“metro-react-native-babel-preset”: “^0.77.0”,
“react”: “18.3.1”,
“react-native”: “0.75.2”,
“react-native-dotenv”: “^3.4.11”,
“react-native-gesture-handler”: “^2.19.0”,
“react-native-safe-area-context”: “^4.10.9”,
“react-native-webview”: “^13.12.2”,
“web3”: “^4.12.1”
},
“devDependencies”: {
“@babel/core”: “^7.25.2”,
“@babel/plugin-transform-class-properties”: “^7.25.4”,
“@babel/plugin-transform-private-methods”: “^7.25.4”,
“@babel/plugin-transform-private-property-in-object”: “^7.24.7”,
“@babel/preset-env”: “^7.25.4”,
“@babel/runtime”: “^7.20.0”,
“@react-native/babel-preset”: “0.75.2”,
“@react-native/eslint-config”: “0.75.2”,
“@react-native/metro-config”: “0.75.2”,
“@react-native/typescript-config”: “0.75.2”,
“@types/react”: “^18.2.6”,
“@types/react-test-renderer”: “^18.0.0”,
“babel-jest”: “^29.6.3”,
“babel-loader”: “^9.1.3”,
“eslint”: “^8.19.0”,
“jest”: “^29.6.3”,
“nodemon”: “^3.1.4”,
“prettier”: “2.8.8”,
“react-test-renderer”: “18.3.1”,
“typescript”: “5.0.4”,
“webpack”: “^5.94.0”,
“webpack-cli”: “^5.1.4”
},
“engines”: {
“node”: “>=18”
}
}
this is the server for running webview / web3auth web sdk:
const express = require(‘express’);
const path = require(‘path’);
const app = express();
const PORT = 8080;
// Serve static files from the public directory
app.use(express.static(path.join(__dirname, ‘public’)));
// Handle all requests and send back the web3auth-login.html file
app.get(‘/’, (req, res) => {
res.sendFile(path.join(__dirname, ‘public’, ‘web3auth-login.html’));
});
// Start the server
app.listen(PORT, () => {
console.log(Server is running on http://localhost:${PORT}
);
});