Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

129
Vistas
i cannot sign in to my app using existing google account

i cannot sign in to my app using existing google account. it loads when i clicked and asked me to wait a moment but then nothing happened.

my script.js

function onSignIn(googleUser) {
   $.ajax({
        url: `${baseUrl}/users/googlelogin`,
        method: "POST",
        data: {
            access_token: googleUser.getAuthResponse().id_token,
            googleToken: id_token
        }
    })
        .done((response) => {
            console.log(response, "ini response dr client")
            localStorage.setItem("access_token", response.access_token)
            authentication()
        })
        .fail((err) => {
            console.log(err);
            swal(
            "Oops!", xhr.responseJSON.error[0], "error")
            console.log(xhr.responseJSON.error[0])
        })
        


}

my controller file:

static async googleLogin(req, res, next) {
      try {
      console.log("masuk google login")

        const { id_token } = req.body
        const client = new OAuth2Client(process.env.GOOGLE_CLIENT_ID)
        const ticket = await client.verifyIdToken({
            idToken: id_token,
            audience: process.env.GOOGLE_CLIENT_ID
        });

        const payload = ticket.getPayload()
        const email = payload.email
        let password = email.toString().split('@')
        password = password[0]
        let user = await User.findOne({ where: { email } })
        if (!user) {
            let newUser = { email, password }
            let createUser = await User.create(newUser)
            const payload = {
                id: createUser.id,
                email: createUser.email
            }
            const access_token = generateToken(payload)
            return res.status(201).json({ access_token })
        } else {
            const payload = {
                id: user.id,
                email: user.email
            }
            const access_token = generateToken(payload)
            return res.status(200).json({ access_token })
        }

      } catch (err) {
          console.log(err)
          return next(err)
      }
    }

here are the error on console:

  • GET http://localhost:3000/todos 500 (Internal Server Error)
  • Uncaught {error: 'idpiframe_initialization_failed', details: 'You have created a new client application that use…i/web/guides/gis-migration) for more information.'}

i run my app on http://localhost:8080/client/

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda