Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
¿Cómo usar SignInWithRedirect con GoogleAuthProvider?

Estoy creando una aplicación Vue (Vue versión 2). Estoy usando Firebase (Web versión 9) como base de datos y para la autenticación. Estoy usando Google como método de inicio de sesión. En el escritorio, quiero usar el método signInWithPopup, que funciona perfectamente bien. Sin embargo, recomiendan usar signInWithRedirect en dispositivos móviles. No entiendo cómo se debe usar este segundo método. Esto es lo que he hecho hasta ahora:

 googleSignIn: async function () { const auth = getAuth(); const provider = new GoogleAuthProvider(); try { let result; if (this.isMobile) { await signInWithRedirect(auth, provider); result = await getRedirectResult(auth); if (result) { console.log(result); } else { console.log("no result"); } } else { result = await signInWithPopup(auth, provider); } const googleUser = result.user; const query = await db .collection("users") .where("email", "==", googleUser.email) .get(); if (!query.empty) { this.$store.dispatch("setUser", googleUser.reloadUserInfo); this.$router.push({ path: "/dashboard" }); } else { alert("impossible de se connecter"); } } catch (err) { console.log(err); } }

Aquí están mis importaciones:

 import { getAuth, signInWithPopup, signInWithRedirect, getRedirectResult, GoogleAuthProvider, } from "firebase/auth";
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!