django-web3-auth icon indicating copy to clipboard operation
django-web3-auth copied to clipboard

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

Open WP-LKL opened this issue 2 years ago • 1 comments

  • Django-Web3-Auth version: 0.1.6
  • Django version: 2.0.6
  • Python version: 3.8.10
  • Operating System: WSL

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 avatar Dec 26 '21 23:12 WP-LKL