Closed mateusas96 closed 1 year ago
@mateusas96 At the time of this package creation around may 2022, google haven't added error callbacks back then. As you know this is just a wrapper package using google identity services so that time I wasn't getting any responses from google on popup close and other error events. But I can see that google recently added error callbacks feature https://stackoverflow.com/questions/72387245/google-identity-service-oauth2-detect-if-consent-pop-up-is-closed#answer-73485415 Let me look into this and I will add this feature shortly
Would be amazing, thanks!
@mateusas96 Download the latest version and use any of the following methods to catch the popup closing error
<script setup>
const callback = (response) => {
// This callback will be triggered when the user selects or login to
// his Google account from the popup
console.log(response);
};
const onError = (error) => {
// This callback will be triggered when user closes the login popup
console.log(error);
};
</script>
<template>
<GoogleLogin :callback="callback" :error="onError" popup-type="TOKEN">
<button>Login</button>
</GoogleLogin>
</template>
OR
<script setup>
import { googleTokenLogin } from "vue3-google-login";
const login = () => {
googleTokenLogin()
.then((response) => {
console.log("Handle the response", response);
})
.catch((error) => {
console.log("Error", error);
});
};
</script>
<template>
<button @click="login">Login</button>
</template>
Thank you very much!
Same story as here
I guess this is unfinished package, it is really hard to make it work properly