Google drive api 尝试使用应用程序数据文件夹时发生updateToken身份验证错误

Google drive api 尝试使用应用程序数据文件夹时发生updateToken身份验证错误,google-drive-api,Google Drive Api,我有一个完美的驱动器集成应用程序,基于javascript和go,具有以下范围: https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/drive 现在我尝试使用应用程序文件夹。如果我不更改我的作用域,那么我会得到一个错误,声称应用程序作用域设置不正确。现在,我添加了以下范围(在api控制台和我

我有一个完美的驱动器集成应用程序,基于javascript和go,具有以下范围:

https://www.googleapis.com/auth/userinfo.email
https://www.googleapis.com/auth/userinfo.profile
https://www.googleapis.com/auth/drive
现在我尝试使用应用程序文件夹。如果我不更改我的作用域,那么我会得到一个错误,声称应用程序作用域设置不正确。现在,我添加了以下范围(在api控制台和我的应用程序中):

现在,我不幸地在oauth.updateToken googelapi函数中遇到一个错误,错误消息如下:

OAuthError: updateToken: 400 Bad Request

我是否误解了应用程序文件夹应该如何使用

您需要再次向用户显示一个对话框,并检索一个新令牌,而不是更新现有令牌。通过
config.AuthCodeURL()
创建新的身份验证代码URL,并向用户请求权限。用户授予权限后,通过调用
t.exchange(code)
与Google端点交换代码


您正在尝试交换新的代码令牌吗?谢谢,这非常有意义,关于检索新令牌而不是更新旧令牌。我确实解决了这个问题(在阅读此答案之前),从chrome网站商店中删除/重新安装了应用程序,并在google帐户/管理应用程序上取消了授权),我认为这将使事情进入一个干净的状态,因此没有令牌可更新。
OAuthError: updateToken: 400 Bad Request
var config = &oauth.Config{
  ClientId:     "YOUR_CLIENT_ID",
  ClientSecret: "YOUR_CLIENT_SECRET",
  Scope:        "YOUR_SCOPES",
  RedirectURL:  "YOUR_REDIRECT_URI",
  AuthURL:      "https://accounts.google.com/o/oauth2/auth",
  TokenURL:     "https://accounts.google.com/o/oauth2/token",
}

authUrl := config.AuthCodeURL("state")
fmt.Printf("Go to the following link in your browser: %v\n", authUrl)
t := &oauth.Transport{
  Config:    config,
  Transport: http.DefaultTransport,
}

// Read the code, and exchange it for a token.
fmt.Printf("Enter verification code: ")
var code string
fmt.Scanln(&code)
_, err := t.Exchange(code)
if err != nil {
  fmt.Printf("An error occurred exchanging the code: %v\n", err)
}