reactjs - 如何在反应中向 Firebase REST API 发送 POST 请求
问题描述
我正在尝试使用 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]
解决方案
您可以选择本机 fetch api
window.fetch('https://url-you-want-to-post-to.com/', {method: 'POST', body: { //body data } })
或者你可以使用第三方库,比如 axios(虽然你需要先 npm install 再导入)
推荐阅读
- shopify - but titles on variants | shopify
- javascript - Rotate Icon on click
- python - How to write Elasticsearch query in elasticsearch_dsl in python
- c++ - How to deal with dependencies when cross-compiling
- git - 寻求有关 Git 克隆和拉取请求的说明
- c# - 异步委托转换/转换
- r - How do you find the index in R
- unicode - 将 Microsoft WGL4 Charmap 转换为 wxString?
- mysql - 使用不同的值选择排序后的第一行
- excel-2010 - Excel - 在开始时间和结束时间之间打开时以相同流程运行的时间间隔