【发布时间】:2015-07-20 05:43:00
【问题描述】:
我正在使用Grant 与 google 进行 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 而失败。
我做错了什么吗?该库似乎没有错误。
【问题讨论】:
-
问题已在此处解决 - github.com/simov/grant/issues/18
-
@simo 请将其作为答案提交
标签: javascript node.js oauth-2.0 grant-oauth