Firebase-将自定义参数设置为提供程序意味着什么? [英] Firebase - What this means to set custom parameters to provider?

查看:55
本文介绍了Firebase-将自定义参数设置为提供程序意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在使用Firebase身份验证.并找到了许多教程,他们像这样为提供者设置了自定义参数

Currently i am working with firebase authentication. And found many of tutorials, they set custom parameters to provider like that

const provider = new firebase.auth.GoogleAuthProvider();
provider.setCustomParameters({ prompt: 'select_account' });

这实际上意味着设置自定义参数提示吗?为什么我们需要设置类似的自定义参数-在本例中为 prompt:'select_account'吗?

What this actually means setting custom parameters prompt ? Why we need to set custom parameters like that - in this case prompt: 'select_account' ?

推荐答案

阅读 GoogleAuthProvider.setCustomParameters的API文档:

设置OAuth自定义参数以传递Google OAuth请求以用于弹出和重定向登录操作.有效参数包括"hd",'hl','include_granted_scopes','login_hint'和'prompt'.为一个详细列表,请查看 Google 文档.保留必需的OAuth不允许使用2.0参数,例如"client_id","redirect_uri","scope","response_type"和"state".

Sets the OAuth custom parameters to pass in a Google OAuth request for popup and redirect sign-in operations. Valid parameters include 'hd', 'hl', 'include_granted_scopes', 'login_hint' and 'prompt'. For a detailed list, check the Google documentation. Reserved required OAuth 2.0 parameters such as 'client_id', 'redirect_uri', 'scope', 'response_type' and 'state' are not allowed and will be ignored.

如果您点击了指向Google文档的链接,则该链接将针对提示且其值为 select_account :

If you follow the link to the Google documentation, it says, for prompt with value select_account:

授权服务器提示用户选择用户帐户.这允许具有多个帐户的用户在授权时服务器从他们可能拥有的多个帐户中进行选择当前会话.

The authorization server prompts the user to select a user account. This allows a user who has multiple accounts at the authorization server to select amongst the multiple accounts that they may have current sessions for.

因此,如果您希望用户能够从他们可能拥有的多个Google帐户(而不是主要帐户)中进行选择,则应包括此参数.

So, if you want the user to be able to choose from multiple Google accounts that they might have (instead of just the primary account), you should include this parameter.

这篇关于Firebase-将自定义参数设置为提供程序意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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