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>
誰もがそれを修正する方法を知っていますか?