Coder Social home page Coder Social logo

web3auth's Introduction

Web3Auth

What is Web3Auth?

Web3Auth, is pluggable infrastructure that enables Web3 wallets and applications to provide seamless user logins for both mainstream and Web3.0 users. By aggregating OAuth (Google, Twitter, Discord) logins, different wallets, and existing key management solutions, Web3Auth provides dApps/wallets a familiar experience that fits every user.

Official Documentation


Install

Install these dependencies:

yarn add @web3auth/base
yarn add @web3auth/web3auth

Basic Setup

 import { Web3Auth } from "@web3auth/web3auth";
 import { CHAIN_NAMESPACES, ADAPTER_EVENTS } from "@web3auth/base";

 (async () => {
    // We are initializing with EIP155 namespace which
    // will initialize the modal with ethereum mainnet
    // by default.
    const web3auth = new Web3Auth({
        chainConfig: { chainNamespace: CHAIN_NAMESPACES.EIP155 },
        clientId: "localhost-id" // get your clientId from https://developer.web3auth.io
    });

    await web3auth.initModal();
    // listening to modal events, on successful login, `CONNECTED` event will be emitted.
    subscribeAuthEvents(web3auth: Web3AuthModal) {
      web3auth.on(ADAPTER_EVENTS.CONNECTED, (adapterName: string)=>{
        console.log("connected to wallet", adapterName, web3auth.provider)
      })
      web3auth.on(ADAPTER_EVENTS.CONNECTING, ()=>{
        console.log("connecting")

      })
      web3auth.on(ADAPTER_EVENTS.DISCONNECTED, ()=>{
        console.log("disconnected")
      })
      web3auth.on(ADAPTER_EVENTS.ERRORED, (error)=>{
        console.log("errored", error)
      })
    }

    // you can use this provider with web3
    const provider = await web3auth.connect();
 })()

web3auth's People

Contributors

himanshuchawla009 avatar chaitanyapotti avatar lionellbriones avatar tainguyentt avatar phuctm97 avatar metallicalfa2 avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.