Please provide the following details too when asking for help in this category:
- SDK Version: 7.0.1
- Platform: VueJS (Web)
- Browser Console Screenshots:
Please provide the Web3Auth initialization and login code snippet below:
HTML
<template>
<div>
<h1>Web3Auth Basic Authentication</h1>
<div class="user">
<button class="user__btn" @click="loginWithProvider('twitter')">
Twitter Login
</button>
<button class="user__btn" @click="loginWithProvider('apple')">
Apple Login
</button>
<button class="user__btn" @click="loginWithProvider('google')">
Google Login
</button>
<button class="user__btn" @click="logout">
Logout
</button>
</div>
<div v-if="error" class="error">
{{ error }}
</div>
</div>
</template>
JS Code
async loginWithProvider(provider) {
try {
await this.$store.dispatch("web3Auth/loginWithProvider", provider);
this.error = null; // Reset any previous errors
} catch (error) {
this.error = "Authentication failed. Please try again.";
console.error("Authentication error:", error);
}
},
Additional Info
We set a different value for the VUE_APP_URL
and VUE_APP_PORT
environment settings because we don’t want to use the localhost as our local development URL