【问题标题】:How to send a POST request to Firebase REST API in react如何在反应中向 Firebase REST API 发送 POST 请求
【发布时间】:2020-07-22 17:30:57
【问题描述】:

我正在尝试使用 OAuth 凭据登录,这涉及向 Auth verifyAssertion 端点发出 HTTP POST 请求。我将如何在语法上执行此操作?我正在尝试遵循这个 firebase 文档,但他们使用 curls 作为示例。

https://firebase.google.com/docs/reference/rest/auth/#section-sign-in-with-oauth-credential

端点是https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=[API_KEY]

【问题讨论】:

    标签: reactjs firebase rest express firebase-authentication


    【解决方案1】:

    您可以选择原生 fetch api

    window.fetch('https://url-you-want-to-post-to.com/', {method: 'POST', body: { //body data } })

    也可以使用axios之类的第三方库(虽然需要先npm install再导入)

    【讨论】:

    • 在链接中它要求一个 requestUri。那究竟是什么?我是否必须在数据中包含所有身体参数?
    猜你喜欢
    • 2019-03-29
    • 2018-11-02
    • 1970-01-01
    • 2018-07-14
    • 2018-08-04
    • 2021-05-08
    • 1970-01-01
    • 2013-02-25
    • 1970-01-01
    相关资源
    最近更新 更多