프로필 정보 가져오기

기본 범위를 사용하여 Google에 사용자가 로그인한 후 사용자의 Google ID, 이름, 프로필 URL, 이메일 주소에 액세스할 수 있습니다.

사용자의 프로필 정보를 검색하려면 getBasicProfile() 메서드를 사용합니다. 예를 들면 다음과 같습니다.

// auth2 is initialized with gapi.auth2.init() and a user is signed in.

if (auth2.isSignedIn.get()) {
  var profile = auth2.currentUser.get().getBasicProfile();
  console.log('ID: ' + profile.getId());
  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());
}