Intento probar el proceso de inicio de sesión con firebase/la plataforma de identidad de GCP para firebase.auth.GoogleAuthProvider con un sitio web estático simple.
Cuando implemento el sitio web obtengo
Error de autorización Error 401: delete_client Se eliminó el cliente de OAuth.
Mi página web con código javascript se ve así:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Sample FirebaseUI App</title> <script src="https://www.gstatic.com/firebasejs/8.0/firebase.js"></script> <script> var config = { apiKey: "<secret-key>", authDomain: "<my-gcp-project>.firebaseapp.com", }; firebase.initializeApp(config); </script> <script src="https://www.gstatic.com/firebasejs/ui/6.0.0/firebase-ui-auth.js"></script> <link type="text/css" rel="stylesheet" href="https://www.gstatic.com/firebasejs/ui/6.0.0/firebase-ui-auth.css"/> <script type="text/javascript"> // FirebaseUI config. var uiConfig = { signInSuccessUrl: 'https://<my-url-after-success-login>', signInOptions: [ // Leave the lines as is for the providers you want to offer your users. firebase.auth.GoogleAuthProvider.PROVIDER_ID ], // tosUrl and privacyPolicyUrl accept either url string or a callback // function. // Terms of service url/callback. tosUrl: 'https://<my-url-after-success-login>', // Privacy policy url/callback. privacyPolicyUrl: function () { window.location.assign('https://<my-url-after-success-login>'); } }; // Initialize the FirebaseUI Widget using Firebase. var ui = new firebaseui.auth.AuthUI(firebase.auth()); // The start method will wait until the DOM is loaded. ui.start('#firebaseui-auth-container', uiConfig); </script> </head> <body> <!-- The surrounding HTML is left untouched by FirebaseUI. Your app may use that space for branding, controls and other customizations.--> <h1>Welcome to My Awesome App</h1> <div id="firebaseui-auth-container"></div> </body> </html>Cuando llamo a la página web implementada, tengo este botón "Iniciar sesión con Google". Pero cuando hago clic en él, aparece este error 401.
Los valores para apiKey: "", authDomain: ".firebaseapp.com",
Copié desde la consola GCP en "DETALLES DE CONFIGURACIÓN DE LA APLICACIÓN" Google es el único proveedor habilitado en "Plataforma de identidad".
Cualquier pista es bienvenida. https://github.com/firebase/firebaseui-web parece una introducción más sistemática a este tema. Solo pensé que lo hacía funcionar con un mínimo esfuerzo.
Mi proceso de configuración no estaba completo. Ahora está funcionando.
https://firebase.google.com/docs/web/setup Ahora también tengo 4 líneas adicionales para la variable de configuración.
projectId: "<my_project_id>", storageBucket: "<my_value>", messagingSenderId: "<my_id>", appId: "<my_app_id>"