4

次のようにしてGoogleのログインボタンを作成しようとしています。this linkこれまでのところ、アカウントの選択ダイアログボックスが表示されますが、その後はコンソールに結果が表示されません。代わりに、私は、ページの読み込み時にこのエラー、Googleでのidpiframe_initialization_failedローカルホストからのログイン

"idpiframe_initialization_failed", details: "Not a valid origin for the client: http://localhos…itelist this origin for your project's client ID." 
details: "Not a valid origin for the client: http://localhost has not been whitelisted for client ID 386404527657-q4ss06np5g27dllq5ds7aif42udkh7e5.apps.googleusercontent.com. Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID." 
ここ

はコード、

<html lang="en"> 
    <head> 
    <meta name="google-signin-scope" content="profile email"> 
    <meta name="google-signin-client_id" content="YOUR_CLIENT_ID.apps.googleusercontent.com"> 
    <script src="https://apis.google.com/js/platform.js" async defer></script> 
    </head> 
    <body> 
    <div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"</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; 
     console.log("ID Token: " + id_token); 
     }; 
    </script> 
    </body> 
</html> 

ている私は本当にこの問題を解決し、私のコンソールで結果を取得する必要があります。私はこれを解決するために次に何をすべきか分かりません。これに助けが必要です、ありがとう!

+0

クライアントIDを使用しましたか? ThdK

+0

はい。私はちょうどセキュリティ上の理由からここに入れなかった。 –

答えて

0

私はこの正確な問題を抱えており、this solutionが私のために働いていました。

要するに、ブラウザのキャッシュを消去します。

Chrome:設定 - >詳細設定 - >閲覧データの消去 - >キャッシュされた画像とファイル

+0

ありがとう、私は後で見てみましょう。 –

関連する問題