小编Inq*_*Tom的帖子

使用 Firebase 身份验证和 gAPI?

如何让 Firebase Auth 与 Google Drive api 配合使用?

使用 React,我的 firebase auth 工作和 googledrive(gapi)都可以单独工作,但正在努力将两者合并。

借助 Firebase 9,访问 Google API 变得更加容易:This gives you a Google Access Token. You can use it to access Google APIs.

我的想法是获取令牌,然后将其传递给gapi.init函数。然而,我不知道之后该去哪里。任何正确方向的指导将不胜感激!

import { getAuth, getRedirectResult, GoogleAuthProvider } from "firebase/auth";

onst auth = getAuth();
signInWithPopup(auth, provider)
  .then((result) => {
    // This gives you a Google Access Token. You can use it to access the Google API.
    const credential = GoogleAuthProvider.credentialFromResult(result);
    const token = credential.accessToken; …
Run Code Online (Sandbox Code Playgroud)

javascript firebase google-api-js-client reactjs

7
推荐指数
1
解决办法
521
查看次数

Nextjs:表单提交 POST 时出现 405

按照本教程,我尝试在 Nextjs 中提交表单,但在尝试 POST 到我的 api 路由时收到 405 错误。我尝试过使用 axios 和 fetch api。这看起来应该很简单,但我不确定我哪里出错了。我缺少什么明显的东西吗?谢谢!

/调查/创建

const handleSubmit = async (event) => {
    event.preventDefault();

    const testData = {
      title: surveyTitle,
    };

    const res = await fetch("/api/survey", {
      method: "POST",
      body: JSON.stringify({
        dataName: testData,
      }),
      headers: {
        "Content-Type": "application/json",
      },
    });
  };

Run Code Online (Sandbox Code Playgroud)

/api/调查

export default function handler(req, res) {
  console.log(req.body);
  res.status(200).json(JSON.stringify({ name: 'Success' }))
}
Run Code Online (Sandbox Code Playgroud)

javascript shopify reactjs next.js shopify-app

6
推荐指数
0
解决办法
3950
查看次数