When using web3 only to sign into user account, it is necessary to prove your identity with a private key (e.g. The main reason is that when using a DApp, you most likely don’t have an account on the website, it’s accessible only with web3 (Metamask). Why do i have to sign a message? It’s not needed in MyEtherWallet or other DApps! Or, even better, sends them a ‘restore password’ link.Īlso, it’s possible to copy signup_view to your project, assign it a url, and add the corresponding lines to set some password for a user. There should be some code in your project that generates a password using _random_password and sends it to a user email. How do i deal with user passwords or Password is not set Meaning that the user can now login as any of those accounts (sometimes being the wrong one).Ģ. This is needed because if it’s not, the user can register a new account with the same address as the other one, If you set a custom address field (WEB3AUTH_USER_ADDRESS_FIELD), it MUST be unique (unique=True). If you have any questions left, head to the example app Important details and FAQ Set your User model’s field to use as ETH address provider: WEB3AUTH_USER_ADDRESS_FIELD = 'username'Īnd if you have some other fields you want to be in the SignupForm, add them too: WEB3AUTH_USER_SIGNUP_FIELDS = Īdd Django-Web3-Auth’s URL patterns: from web3auth import urls as web3auth_urls urlpatterns = Īdd some javascript to handle login: function startLogin (). Set ‘3Backend’ as your authentication backend: AUTHENTICATION_BACKENDS = Install Django-Web3-Auth with pip: pip install django-web3-authĪdd it to your INSTALLED_APPS: INSTALLED_APPS = (. VERY customizable - uses Django settings, allows for custom User model Uses random token signing as proof of private key posession There is a README file for you to check, also. You can check out our example project by cloning the repo and heading into example/ directory. The user authenticates themselves by digitally signing the session key with their wallet’s private key. Django-web3-auth is a pluggable Django app that enables login/signup via an Ethereum wallet (a la CryptoKitties).
0 Comments
Leave a Reply. |