संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
Google साइन इन क्लाइंट को शुरू करने के बाद, उपयोगकर्ता के सेशन की स्थिति का पता लगाने के लिए, क्लाइंट के अलग-अलग एट्रिब्यूट और तरीकों की जांच करने वाले हैंडलर अटैच किए जा सकते हैं. क्लाइंट ऑब्जेक्ट से मिली जानकारी का इस्तेमाल करके, उपयोगकर्ता के लिए कई टैब और डिवाइसों पर अपनी साइट के उपयोगकर्ता अनुभव को सिंक किया जा सकता है.
यहां दिए गए कोड में, 2.0 क्लाइंट का तरीका इस्तेमाल करके attachClickHandler कॉलबैक बनाने का तरीका बताया गया है. यह कॉलबैक, उपयोगकर्ता के लिए साइन-इन की प्रोसेस को चुपचाप पूरा करता है या उपयोगकर्ता के सेशन की स्थिति के आधार पर, उसे फिर से अनुमति देने के लिए कहता है.
/**
* The Sign-In client object.
*/
var auth2;
/**
* Initializes the Sign-In client.
*/
var initClient = function() {
gapi.load('auth2', function(){
/**
* Retrieve the singleton for the GoogleAuth library and set up the
* client.
*/
auth2 = gapi.auth2.init({
client_id: 'CLIENT_ID.apps.googleusercontent.com'
});
// Attach the click handler to the sign-in button
auth2.attachClickHandler('signin-button', {}, onSuccess, onFailure);
});
};
/**
* Handle successful sign-ins.
*/
var onSuccess = function(user) {
console.log('Signed in as ' + user.getBasicProfile().getName());
};
/**
* Handle sign-in failures.
*/
var onFailure = function(error) {
console.log(error);
};
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2024-11-21 (UTC) को अपडेट किया गया."],[[["The Google Sign-In JavaScript library is deprecated and will eventually be sunset; developers should consult the Deprecation and Sunset guide for migration details and timelines."],["Google Sign-In will require the use of FedCM APIs in the future, so developers should conduct an impact assessment to ensure their sign-in functionality remains unaffected."],["This page provides code demonstrating how to initialize the Google Sign-In client and attach click handlers to manage user sign-in and session state."],["Developers can utilize the `auth2` object to handle successful and failed sign-in attempts, accessing user information upon successful authentication."]]],[]]