Firebase Auth Emulator电子邮件/密码登录REST端点 [英] Firebase Auth Emulator email/password Sign In REST endpoint

查看:95
本文介绍了Firebase Auth Emulator电子邮件/密码登录REST端点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用此端点 https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key= [API-KEY] (位于

I'm able to use this endpoint https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=[API-KEY] (found in these docs @ section Sign In With Email / Password) to sign in a Firebase Authentication user via an HTTP request.

无论如何,在Firebase身份验证仿真器上是否可以完成此操作-是否存在将提供相同功能的仿真器REST端点?

Is there anyway to accomplish this on the Firebase Authentication Emulator - is there an emulator REST endpoint which will serve the same function?

当我在端口9099上运行身份验证仿真器时,我已经尝试过-
. http://localhost:9099/v1/accounts:signInWithPassword?key = [API-KEY]
. http://localhost:9099/emulator/v1/accounts:signInWithPassword?key = [API-KEY]
. http://identitytoolkit.localhost:9099/emulator/v1/accounts:signInWithPassword?key = [API-KEY]
. http://localhost:9099/identitytoolkit/v3/relyingparty/verifyPassword?key = [API-KEY]

When I run the auth emulator on port 9099 I've tried -
. http://localhost:9099/v1/accounts:signInWithPassword?key=[API-KEY]
. http://localhost:9099/emulator/v1/accounts:signInWithPassword?key=[API-KEY]
. http://identitytoolkit.localhost:9099/emulator/v1/accounts:signInWithPassword?key=[API-KEY]
. http://localhost:9099/identitytoolkit/v3/relyingparty/verifyPassword?key=[API-KEY]

但是没有任何作用.有什么想法吗?

But none work. Any ideas?

这是我对每个请求的响应-

Here is the response I get for each of these requests -

{
    "error": {
        "code": 404,
        "message": "Not Found",
        "errors": [
            {
                "message": "Not Found",
                "reason": "notFound"
            }
        ],
        "status": "NOT_FOUND"
    }
}

还尝试了以下方法: http://localhost:9099/identitytoolkit.googleapis.com/v1/projects/emulator-test-project-id/accounts?key = [API-KEY]

但是得到回应

{
    "error": {
        "code": 400,
        "message": "INSUFFICIENT_PERMISSION : Only authenticated requests can specify target_project_id.",
        "errors": [
            {
                "message": "INSUFFICIENT_PERMISSION : Only authenticated requests can specify target_project_id.",
                "reason": "invalid",
                "domain": "global"
            }
        ]
    }
}

推荐答案

此方法有效-

http://localhost:[PORT]/identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key= [API-KEY]

其中 API-KEY 可以是任何字符串,而9099是运行身份验证模拟器的 PORT .对我而言,默认值为9099,但是您可以通过 firebase.json (

where API-KEY can be any string and 9099 is the PORT on which the auth emulator is running. For me it defaults to 9099 but you can configure this via your firebase.json (more details here)

这篇关于Firebase Auth Emulator电子邮件/密码登录REST端点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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