Estoy tratando de redirigir a una página llamada "profile.html" después de iniciar sesión en Google. Mi código actual me redirige a la página de inicio de sesión después de un inicio de sesión exitoso. Esto es lo que tengo hasta ahora.
<body> <div class='center'> <div class="g-signin2" data-onsuccess="onSignIn" data-theme="light" data-width="300" data-height="50" data-margin="300" data-longtitle="true"></div> </div> <script> function onSignIn(googleUser) { // Useful data for your client-side scripts: var profile = googleUser.getBasicProfile(); console.log("ID: " + profile.getId()); // Don't send this directly to your server! console.log('Full Name: ' + profile.getName()); console.log('Given Name: ' + profile.getGivenName()); console.log('Family Name: ' + profile.getFamilyName()); console.log("Image URL: " + profile.getImageUrl()); console.log("Email: " + profile.getEmail()); // The ID token you need to pass to your backend: var id_token = googleUser.getAuthResponse().id_token; postAJAX('/server/sign-in', { id_token: id_token }) .then(function(user) { // I am trying to redirect after login to profile html window.location.href = 'profile.html'; }) }; </script> </body>