且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Google+ JavaScript API:如何检测用户登录状态?

更新时间:2023-09-14 11:03:52

如果您已经添加了登录按钮,则无需使用单独的函数调用来确定用户的登录状态.登录按钮的回调将在登录时,页面加载时或用户登录状态更改时触发.页面加载触发器(立即模式)也将有助于指示该用户是否是Google登录用户.

You don't need to use a separate function call to determine the user's signed in state if you've already added the sign-in button. The sign-in button's callback is going to trigger either on sign-in, when the page loads, or any time that the user's signed-in status changes. The page load trigger (immediate mode), will also help to indicate if the user is a Google signed-in user or not.

请参见监视用户的登录状态,其中显示了不同的内容您可以检查的状态字段(Google已登录,应用已登录或已退出).

See monitoring the user's signed in status, which shows the different status fields that you can check (Google signed in, app signed in, or signed out).