What I am trying to do is create my own UI (I don’t need a modal, I just need the form). I tried the examples in the documentation (integration builder) as well as the one here:
-
SDK Version:
“@web3auth/base”: “^5.0.1”,
“@web3auth/no-modal”: “^5.0.1”, -
Platform:
macOS 13.2.1
Node 18.12.1
Vue ^3.2.38
Vite ^3.0.9 -
Browser Console Screenshots:
Below you can find the basic code for the component.
<template>
<div id="app">
<button class="card" style="cursor: pointer" @click="login">Login</button>
</div>
</template>
<script lang="ts" setup>
import { onMounted } from 'vue';
import { Web3AuthNoModal } from '@web3auth/no-modal';
import { CHAIN_NAMESPACES } from '@web3auth/base';
const clientId = import.meta.env.VITE_CLIENT_ID;
const web3auth = new Web3AuthNoModal({
clientId, // get it from Web3Auth Dashboard
web3AuthNetwork: 'testnet',
chainConfig: {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: '0xA869',
rpcTarget: 'https://api.avax-test.network/ext/bc/C/rpc',
},
});
onMounted(async () => {
await web3auth.init();
});
const login = async () => {
await web3auth.connectTo('openlogin', {
loginProvider: 'google',
});
};
</script>