Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Google ile oturum açma istemcisi başlatıldıktan sonra, kullanıcının oturum durumunu belirlemek için istemcinin çeşitli özelliklerini ve yöntemlerini kontrol eden işleyiciler ekleyebilirsiniz. İstemci nesnesi tarafından döndürülen bilgileri kullanarak sitenizin kullanıcı deneyiminin birden fazla sekme ve cihaz arasında senkronize edilmesine yardımcı olabilirsiniz.
Aşağıdaki kodda, kullanıcı için sessizce oturum açma işlemini tamamlayan veya kullanıcının oturumunun durumuna göre kullanıcıdan yeniden yetkilendirme yapmasını isteyen bir geri çağırma oluşturmak üzere 2.0 istemci yönteminin attachClickHandler nasıl kullanıldığı gösterilmektedir.
/***TheSign-Inclientobject.*/varauth2;/***InitializestheSign-Inclient.*/varinitClient=function(){gapi.load('auth2',function(){/***RetrievethesingletonfortheGoogleAuthlibraryandsetupthe*client.*/auth2=gapi.auth2.init({client_id:'CLIENT_ID.apps.googleusercontent.com'});//Attachtheclickhandlertothesign-inbuttonauth2.attachClickHandler('signin-button',{},onSuccess,onFailure);});};/***Handlesuccessfulsign-ins.*/varonSuccess=function(user){console.log('Signed in as '+user.getBasicProfile().getName());};/***Handlesign-infailures.*/varonFailure=function(error){console.log(error);};
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-07-25 UTC."],[[["\u003cp\u003eThe 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.\u003c/p\u003e\n"],["\u003cp\u003eGoogle 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.\u003c/p\u003e\n"],["\u003cp\u003eThis page provides code demonstrating how to initialize the Google Sign-In client and attach click handlers to manage user sign-in and session state.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can utilize the \u003ccode\u003eauth2\u003c/code\u003e object to handle successful and failed sign-in attempts, accessing user information upon successful authentication.\u003c/p\u003e\n"]]],[],null,[]]