我在自己的网站上嵌入了Google登录按钮。该网站是使用Google协作平台建立的。当我尝试单击登录按钮时,它显示错误,但未显示正确的URL。
我尝试将正确的URL添加到我的OAuth同意屏幕,但没有成功。试图添加http,https,/,*,但没有运气。
<html lang="en">
<head>
<meta name="google-signin-scope" content="profile email">
<meta name="google-signin-client_id" content="862xxxxxxxxxxxxp14i5id5vk.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>
我的预期输出是使用户使用OAuth登录。