Google Sign In login does not work on the Edge and Opera browsers, plus Google Chrome and Mozilla works

Asked

Viewed 74 times

0

Hello guys this is the error I get when I click the Google Login button in the Opera and Edge browsers. The stranger that errors do not appear in Mozilla and Google Chrome, Chrome and Mozilla log first goes normal.

My heart says javascri pt

function onSignIn(response) {
    console.log("1");
    // Conseguindo as informações do seu usuário:
    var perfil = response.getBasicProfile();

    // Conseguindo o ID do Usuário
    var userID = perfil.getId();

    // Conseguindo o Nome do Usuário
    var userName = perfil.getName();

    // Conseguindo o E-mail do Usuário
    var userEmail = perfil.getEmail();

    if(userEmail != ""){
            botaoDeDeslogar(); //aparece o botao de deslogar
            botaoDeLogar();  //esconde o botao de logar      
        }

    if(userEmail == ""){

        }
    // Conseguindo a URL da Foto do Perfil
    var userPicture = perfil.getImageUrl();

    //document.getElementById('user-photo').src = userPicture;
    //document.getElementById('user-name').innerText = userName;
    //document.getElementById('user-email').innerText = userEmail;

    // Recebendo o TOKEN que você usará nas demais requisições à API:
    var LoR = response.getAuthResponse().id_token;
    console.log("Token: " + LoR);

};

$('#google_plus_a').on('click', function (e) {
    console.log("2");
    e.preventDefault();
    var auth2 = gapi.auth2.getAuthInstance();
    auth2.signOut().then(function () {
        console.log("3");
        console.log('User signed out.');
    });
});



Tambem ja tentei assim 

//---------------------------------------------------------------------------------------------------

// verifica se o usuário está; logado e executa ações
// executa ações se o usuário estiver logado
/*gapi.load('auth2', function () {
    console.log("4");
    gapi.auth2.init({

        client_id: '428001492988-ouocv0d188o1nu3rdhas2dcatahsae1a.apps.googleusercontent.com',

    }).then(function () {
        console.log("5");
        auth2 = gapi.auth2.getAuthInstance();
        console.log(auth2.isSignedIn.get()); // Agora isso sempre retorna corretamente 

        if (auth2.isSignedIn.get() == true) {
            botaoDeDeslogar(); //aparece o botao de deslogar
            botaoDeLogar();  //esconde o botao de logar            
            console.log("6");
        } else {
            //usuarioDeslogadoGoogle();
            console.log("7");
        }
    });
});*/

//---------------------------------------------------------------------------------------------------------------------------------------------------



//Botao de login do google esta aparencedo display block
function botaoDeLogar() { 
    console.log("8");
    console.log("Usuário não esta conectado com o Google deseja logalo BT none!");
    $('#g-signin2').css('display', 'none'); //Botão de login do google desaparece
}

function botaoDeLogar2() { 
    console.log("9");
    console.log("Usuário não esta conectado com o Google deseja logalo BT block!");
    $('#g-signin2').css('display', 'block'); //Botão de login do google aparece
}

// Botao de sair se o usuario estiver logado esta aparencendo display none
function botaoDeDeslogar() {
    console.log("10");
    console.log("O usuário está conectado com o Google deseja desconectalo.");
    $('#google_plus_a').css('display', 'block'); //Botao de sair aparece
}

My head where calls the Google API

<!-- Infomações do google -->
        <script src="https://apis.google.com/js/platform.js" async defer></script>
        <meta name="google-signin-scope" content="profile email">
        <meta name="google-signin-client_id" content="428001492988-97ub0g6ijog4n440anrgm706ijg0dqqt.apps.googleusercontent.com">



Errors that look like this in the EDGE and OPERA browser - " In Goog le Chrome and Mozill to normal function ".

Error that appears in EDGE and operates when I click the " Google Login button "


400. That’s an error.
Error: redirect_uri_mismatch
The JavaScript origin in the request, https://www.****************.com, does not match the ones authorized for the OAuth client. Visit https://console.developers.google.com/apis/credentials/oauthclient/428001492988-97ub0g6ijog4n440anrgm706ijg0dqqt.apps.googleusercontent.com?project=428001492988 to update the authorized JavaScript origins.
Learn more
Request Details
redirect_uri=storagerelay://https/www.************.com?id=auth604459
response_type=permission id_token
scope=email profile openid
openid.realm=
client_id=428001492988-97ub0g6ijog4n440anrgm706ijg0dqqt.apps.googleusercontent.com
ss_domain=https://www.*************.com
fetch_basic_profile=true
gsiwebsdk=2
That’s all we know.`insira o código aqui`

Error that appears in the console in Opera and Edge

cb=gapi.loaded_0:103 Uncaught 

{error: "idpiframe_initialization_failed", details: "Not a valid origin for the client: https://www..…itelist this origin for your project's client ID."}
details: "Not a valid origin for the client: https://www.******.com has not been whitelisted for client ID 428001492988-97ub0g6ijog4n440anrgm706ijg0dqqt.apps.googleusercontent.com. Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID."
error: "idpiframe_initialization_failed"
__proto__: Object
  • It seems that the past source is invalid, you have to see how google knows the source, maybe by the headerorigin which may not be set automatically by the browser

  • William I’ll take a look and come back here to tell you...

  • William I add more was not. I also receive ----- cb=gapi.loaded_0:103 Uncaught {error: "idpiframe_initialization_failed", Details: "Not a Valid origin for the client: https://www.que... itelist this origin for your project’s client ID."}

  • Error only appears in Opera and Edge in other browsers works normal...I’m bugged here... : D rssrrs

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.