Bearle / django-web3-auth

A pluggable Django app that enables login/signup via an Ethereum wallet (a la CryptoKitties)
Other
88 stars 40 forks source link

Uncaught TypeError: web3.eth is undefined (web3auth.js) #9

Open WP-LKL opened 2 years ago

WP-LKL commented 2 years ago

Description

Run example demo

What I Did

I followed the example README.md.

Running server logs the following in console when attempting to click login: Uncaught TypeError: web3.eth is undefined checkWeb3 http://localhost:8000/static/web3auth/js/web3auth.js:56 startLogin http://localhost:8000/login/:88 onclick http://localhost:8000/login/:1 web3auth.js:56:5

// web3auth.js
function checkWeb3(callback) {
    // web3 = new Web3(window.ethereum)
    web3.eth.getAccounts(function (err, accounts) { // Check for wallet being locked
        if (err) {
            throw err;
        }
        callback(accounts.length !== 0);
    });
}
WP-LKL commented 2 years ago

It seems that @krilarite has a branch with a more functional version: https://github.com/krilarite/django-web3-auth, that I have got to work correctly.