禁止Google+社交登录的自动身份验证 [英] disable automatic authentication for Google+ social sign-in

查看:149
本文介绍了禁止Google+社交登录的自动身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来避免用户在刷新页面时自动验证我的网页。

I'm looking for a way to avoid the user to be automatically authenticated in my web app when he refreshes a page.

例如,用户连接到我的网络应用程序使用他的Google+帐户,并使用该应用一段时间。后来,当他回来的时候,我想让应用程序再次点击登录按钮,而不是自动识别他已经被认证。

For example, the user connects to my web app using his Google+ account and uses the app for a while. Later, when he comes back, I want the app to ask him to click the login button again, instead of automatically recognizing him as already authenticated.

随着Facebook,当调用 FB.init()时,可以将状态属性设置为 false code>,以便在初始化时不会自动验证用户。

With Facebook, I'm able to set the status property to false when calling FB.init(), so that it will not automatically authenticate the user upon initialization.

Google+ SDK可以实现吗?

Is this possible with the Google+ SDK?

提前感谢!

推荐答案

我刚刚发现如何做,以防万一想知道:

I Just found how to do it, in case anyone wants to know:

gapi.signin.render('botaoLoginUsuarioGoogle', {
    'callback': googlePlusSigninCallback,
    'clientid': '-----------------------------',
    'cookiepolicy': 'single_host_origin',
    'requestvisibleactions': 'http://schemas.google.com/AddActivity',
    'scope': 'https://www.googleapis.com/auth/userinfo.email',
    'approvalprompt': "force"
});

根据文档, approvalprompt 属性允许控制用户被重新提示同意的情况,当设置为自动时,如果用户没有授权您的应用程序,用户只能看到OAuth同意对话框。设置为强制时,用户每次都会显示OAuth同意对话框他们点击登录按钮。

According to the documentation, the approvalprompt attribute "Allows control over when the user is re-prompted for consent. When set to auto, the user only sees the OAuth consent dialog if they have not authorized your application. When set to force, the user is shown the OAuth consent dialog each time that they click the sign-in button."

https://developers.google.com/+/web/signin/#sign-in_button_attributes

这篇关于禁止Google+社交登录的自动身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆