डिफ़ॉल्ट स्कोप का इस्तेमाल करके, किसी उपयोगकर्ता को Google से साइन इन करने के बाद, आपके पास उस उपयोगकर्ता का Google आईडी, नाम, प्रोफ़ाइल यूआरएल, और ईमेल पता ऐक्सेस करने का विकल्प होता है.
किसी उपयोगकर्ता की प्रोफ़ाइल की जानकारी पाने के लिए, 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());
}
[null,null,["आखिरी बार 2024-11-22 (UTC) को अपडेट किया गया."],[[["Google Sign-In library support is deprecated, and migration to FedCM APIs will be mandatory soon, requiring an impact assessment."],["After user sign-in, you can access basic profile information like Google ID, name, profile URL, and email address."],["Instead of Google IDs or profile data, utilize ID tokens for secure backend server authentication."],["Google account email addresses are subject to change, so use the account's ID for user identification on both client and backend."]]],[]]