简体   繁体   English

在 API 或 gcloud 的 firebase 项目中启用登录方法

[英]Enable sign-in methods in firebase project from API or gcloud

Its possible to enable sign-in methods (like email and password, for example) in a firebase project with no use the console interface?是否可以在不使用控制台界面的情况下在 firebase 项目中启用登录方法(例如 email 和密码)? I tried use a PATCH request to https://identitytoolkit.googleapis.com/admin/v2/projects/{project-id}/config?updateMask=signIn.email.enabled,signIn.email.passwordRequired , without success.我尝试对https://identitytoolkit.googleapis.com/admin/v2/projects/{project-id}/config?updateMask=signIn.email.enabled,signIn.email.passwordRequired使用 PATCH 请求,但没有成功。 Is it possible to be made with gcloud cli or API request?是否可以使用 gcloud cli 或 API 请求进行?

A general-purpose mechanism for answering this type of question is to use a combination of:回答此类问题的通用机制是使用以下组合:

  1. Chrome's Developer Tools to monitor.network calls while you make changes in the Console;当您在控制台中进行更改时,Chrome 的开发者工具会监控网络调用;
  2. Google's APIs Explorer to interpret REST calls.用于解释 REST 调用的 Google APIs Explorer

I was intrigued by your question and tried this on my own project.我对你的问题很感兴趣,并在我自己的项目中尝试了这个。

By adding, enabling and then deleting the Email provider in the Firebase Console, I was able to grab the underlying REST API calls against identitytoolkit.googleapis.com .通过在 Firebase 控制台中添加、启用然后删除 Email 提供程序,我能够获取针对identitytoolkit.googleapis.com的底层 REST API 调用。

Eg Adding uses projects.updateConfig :例如添加使用projects.updateConfig

/admin/v2/projects/${PROJECT}/config?updateMask=signIn.email.enabled,signIn.email.passwordRequired&alt=json&key=${API_KEY}

And a request body:和一个请求体:

{
  "signIn": {
    "email": {
      "enabled": true,
      "passwordRequired": true
    }
  }
}

There are various request headers you may want to check, including:您可能需要检查各种请求标头,包括:

authorization: SAPISIDHASH {VALUE}

I've not seen SAPISIDHASH before but others have, see this answer.我以前没见过SAPISIDHASH但其他人见过,请参阅答案。

So, you'll need to try to repro PATCH ing the API using that updateMask , your own API key, the body ( Config ) and some variant of those request headers.因此,您需要尝试使用该updateMask 、您自己的PATCH密钥、正文 ( Config ) 和这些请求标头的一些变体来重现 API 。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase 自助登录问题 - Firebase self sign-in issue 尝试为 Firebase 身份验证启用 Google 登录时出现“更新 Google 时出错”消息 - "Error updating Google" message when trying to enable Google Sign-In for Firebase Authentication Google firebase 首次登录时显示没有 email 选项 - Google firebase Sign-in show no email option on first sign-in 如何使用 gcloud 控制台或 firebase 工具 CLI 为新的 firebase 项目启用 email 和密码登录提供程序? - How to enable email and password signin provider for new firebase project using gcloud console or firebase tools CLI? Firebase Auth 登录在将 flutter 项目发布到 Play 商店后不起作用 - Firebase Auth Sign-in does not work after releasing flutter project to Play Store 如何从 Firebase Apple 登录中获取 email 和全名? - How can I get email and full name from Firebase Apple sign-in? Firebase 使用email登录后google登录报错:密码无效或用户没有密码 - Firebase Sign-in with email after google sign-in has error : The password is invalid or the user does not have a password Firebase 身份验证错误“给定的登录提供程序已禁用” - Firebase authentication error "The given sign-in provider is disabled" firebase auth中如何切换邮箱链接和密码登录方式? - How to switch between emailLink and password sign-in method in firebase auth? 使用 flutter (windows) 应用程序进行 firebase 匿名登录时出现 MissingPluginException 异常 - MissingPluginException exception when a firebase anonymous sign-in with flutter (windows) app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM