잘못된 코드로 인해 발생되는 에러입니다.
다음 코드는 구글 사인인 자바스크립트 코드입니다. 잘못된 부분을 찾아 고치세요.
<!-- google sign-in -->
<meta name="google-signin-client_id" content="...이 부분은 삭제한 곳입니다...">
<script>
function onSignIn(googleUser) {
//var profile = googleUser.getBasicProfile();
//console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
//console.log('Name: ' + profile.getName());
//console.log('Image URL: ' + profile.getImageUrl());
//console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
var id_token = googleUser.getAuthResponse().id_token;
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://www.javaspecialist.co.kr/tokensignin');
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onload = function() {
//console.log('Signed in as: ' + xhr.responseText);
window.location = xhr.getResponseHeader("Location");
//document.open();
//document.write(xhr.responseText);
//document.close();
};
xhr.send('idtoken=' + id_token);
}
function onLoad() {
gapi.load('auth2', function() {
gapi.auth2.init();
});
}
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(
function() {
//console.log('User signed out.');
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://www.javaspecialist.co.kr/member/logout');
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onload = function() {
console.log('User signed out.');
window.location.replace("/");
};
xhr.send();
});
}
</script>
|