0

我正在使用Grant与谷歌进行 OAuth2 身份验证。我在 config.json 中提供了所有参数:

  {
    "server": {
    "protocol": "https",
    "host": "thooslo-com-shaunakde.c9.io"
  },
  "google":{
    "authorize_url": "https://accounts.google.com/o/oauth2/auth",
    "access_url": "https://accounts.google.com/o/oauth2/token",
    "oauth": 2,
    "custom_parameters": ["access_type"],
    "scope_delimiter":" ",
    "scope":["https://www.googleapis.com/auth/youtube","https://www.googleapis.com/auth/drive"],
    "client_id":"39109025743-veaeooi4v9ooirabeseujn8u2ohjbqf7.apps.googleusercontent.com",
    "client_secret":"DO8ozwoFqtP654jzi-wPQF10",
    "callback": "/users"
  }
  }

但它仍然拒绝发送所有参数。我收到“client_id”未发送错误。

我修改了库以打印出 URL,确实是这样:

Starting child process with 'node ./bin/www'
https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=https%3A%2F%2Fthooslo-com-shaunakde.c9.io%2Fconnect%2Fgoogle%2Fcallback&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive
GET /connect/google 302 26.492 ms - 574

通过某种排列,我确实设法使第一步工作了一次,但是由于找不到client_secret而失败了。

有什么我做错了吗?该库似乎没有错误。

4

1 回答 1

0

有这个配置就够了

{
    "server": {
    "protocol": "https",
    "host": "thooslo-com-shaunakde.c9.io"
  },
  "google":{
    "key":"39109025743-veaeooi4v9ooirabeseujn8u2ohjbqf7.apps.googleusercontent.com",
    "secret":"DO8ozwoFqtP654jzi-wPQF10",
    "scope":[
      "https://www.googleapis.com/auth/youtube",
      "https://www.googleapis.com/auth/drive"
    ],
    "callback": "/users"
  }
}
于 2015-05-16T09:53:16.900 回答