0
Google 인증을 사용하여 사용자를 인증하려고합니다. 인증을 받아야하지만 로그인 후 사용자를 리디렉션하는 방법 및 로그 아웃 방법을 알지 못합니다.Oauth 2 Google 사용
Google 문서 (https://developers.google.com/identity/sign-in/web/sign-in)를 사용해 보겠습니다. 하지만 오류가 있습니다 : Cannot read property 'getAuthInstance' of undefined
.
<script src="https://apis.google.com/js/platform.js" async defer></script>
<script>
var redirectUri = 'http://localhost:4200/list';
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.
}
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function() {
console.log('User signed out.');
});
}
</script>
사람이 그것을 해결하는 방법을 알고 있나요
: 여기 코드인가?