How to Sign In with Google using Firebase + Nuxt 3

Setup Auth Instance
You can access the current Auth instance in any component with the useFirebaseAuth() composable
<script setup>
const auth = useFirebaseAuth()
</script>
Setup Google Auth Provider
<script setup>
import { GoogleAuthProvider } from "firebase/auth";
const googleAuthProvider = new GoogleAuthProvider();
</script>
Create SignIn Popup method
<script setup>
import { signInWithPopup } from "firebase/auth";
function signinPopup() {
signInWithPopup(auth, googleAuthProvider).catch((reason) => {
console.error("Failed sign", reason);
});
}
</script>
Setup User
<script setup>
const user = useCurrentUser();
</script>
useCurrentUser() composableInsert SignIn button
<button @click="signinPopup()">SignIn with Google</button>



