go-pkgz / auth

Authenticator via oauth2, direct, email and telegram
https://go-pkgz.umputun.dev/auth/
MIT License
1.07k stars 84 forks source link

How to implement Google One Tap #178

Closed irg1008 closed 1 year ago

irg1008 commented 1 year ago

Hi, I was wondering how to reuse callback and login endpoint for google auth while using the one tap solution:

I have the next (Next.JS) front code

export const GoogleOneTap = () => {
  const logInUrl = `${config.apiUrl}/auth/google/callback`
  return (
    <>
      <Script src="https://accounts.google.com/gsi/client" async defer />
      <div
        id="g_id_onload"
        data-client_id={config.googleClientID}
        data-login_uri={logInUrl}
        data-cancel_on_tap_outside="false"
      />
    </>
  )
}

I was wondering if there is a built-in solution or how should I parse the data to achieve one tap login

Thank you