samedi 10 octobre 2020

How to implement google one tap signin with firebase auth for the web application?

I am trying to implement google one tap sign in with firebase auth but i got to know firebase ui doesn't support yolo. and i have tried using the firebase ui document but i am unable to implement google one tap signin with firebase auth. can anyone suggest how can i implement this. i have implemented without firebase auth but i wanted to implement with firebase auth

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://www.gstatic.com/firebasejs/4.1.3/firebase.js"></script>
    <!-- <script src="config.js"></script>
    <script src="common.js"></script> -->
    <script src="https://cdn.firebase.com/libs/firebaseui/3.5.2/firebaseui.js"></script>
    <link
      type="text/css"
      rel="stylesheet"
      href="https://cdn.firebase.com/libs/firebaseui/3.5.2/firebaseui.css"
    />
    <script src="https://apis.google.com/js/platform.js" async defer></script>
    <script src="https://accounts.google.com/gsi/client" async defer></script>
    <script src="https://apis.google.com/js/client.js?onload=authorize"></script>
  </head>
  <body>
    <div id="firebaseui-auth-container"></div>
    <div id="loader">Loading...</div>
    <script>
      ui.start("#firebaseui-auth-container", {
        signInOptions: [
          {
            // Google provider must be enabled in Firebase Console to support one-tap
            // sign-up.
            provider: firebase.auth.GoogleAuthProvider.PROVIDER_ID,
            // Required to enable ID token credentials for this provider.
            // This can be obtained from the Credentials page of the Google APIs
            // console. Use the same OAuth client ID used for the Google provider
            // configured with GCIP or Firebase Auth.
            clientId:
              "321013-ab7ep38c2f6fmb975nqbo09f3eca8569.apps.googleusercontent.com",
          },
        ],
        // Required to enable one-tap sign-up credential helper.
        credentialHelper: firebaseui.auth.CredentialHelper.GOOGLE_YOLO,
      });
      // Auto sign-in for returning users is enabled by default except when prompt is
      // not 'none' in the Google provider custom parameters. To manually disable:
      ui.disableAutoSignIn();
    </script>
  </body>
</html>



Aucun commentaire:

Enregistrer un commentaire