You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

添加Google OAuth API范围后出现“Something went wrong”错误求助

Google OAuth 测试应用请求Slides API权限时出现"Something went wrong"错误
  • 我的Google Cloud项目为外部测试类型(无法改为内部类型),处于测试状态下,请求profile这类基础权限范围时OAuth登录流程完全正常;但请求Slides API的https://www.googleapis.com/auth/presentations权限范围时,在点击"Google hasn't verified the app"提示框的"continue"按钮后,会弹出"Something went wrong"错误。
  • 已完成以下排查操作但问题仍未解决:启用Slides API、在OAuth consent screen中添加对应权限范围、清除该项目关联的所有应用权限。

复现代码

const { OAuth2Client } = require('google-auth-library')
const express = require('express')
const dotenv = require('dotenv')

dotenv.config()

const REDIRECT_URI = 'http://localhost:3000/oauth2callback'
const oauth2Client = new OAuth2Client(process.env.CLIENT_ID, process.env.CLIENT_SECRET, REDIRECT_URI)

const getAuthUrl = () => oauth2Client.generateAuthUrl({
  access_type: 'offline',
//   scope: ['https://www.googleapis.com/auth/userinfo.profile'],
  scope: ['https://www.googleapis.com/auth/presentations'],
})

const getToken = async (code) => {
  const { tokens } = await oauth2Client.getToken(code)
  oauth2Client.setCredentials(tokens)
  return tokens
}

const app = express()

app.get('/', (req, res) => {
  const authUrl = getAuthUrl()
  res.send(`<a href="${authUrl}">Authorize</a>`)
})

app.get('/oauth2callback', async (req, res) => {
  const { code } = req.query
  try {
    const tokens = await getToken(code)
    res.send('Authentication successful! Tokens: ' + JSON.stringify(tokens))
  } catch (error) {
    res.status(400).send('Error during authentication')
  }
})

app.listen(3000, () => console.log('Server running on http://localhost:3000'))

问题截图

Google OAuth授权错误截图

内容的提问来源于stack exchange,提问作者Ch33zig

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 15:31:02