【发布时间】:2015-04-14 07:21:11
【问题描述】:
基于 OAuth 的 G+ 身份验证是否有任何 API 速率限制。
场景
假设有 1000 多人同时点击我的代码来验证他们的 G+ 帐户。
我正在使用 googleapis nodejs 模块进行身份验证
var google = require('googleapis');
var OAuth2 = google.auth.OAuth2;
var plus = google.plus('v1');
var oauth2Client = new OAuth2(appId, appSecret, callbackURL);
var scopes = [
'https://www.googleapis.com/auth/plus.me',
'https://www.googleapis.com/auth/userinfo.email'
];
var url = oauth2Client.generateAuthUrl({
access_type: 'offline', // 'online' (default) or 'offline' (gets refresh_token)
scope: scopes // If you only need one scope you can pass it as string
});
oauth2Client.getToken(googleCode, function(err, tokens) {
if(!err) {
oauth2Client.setCredentials(tokens);
logger.debug(":: G+ access token ::" + JSON.stringify(tokens));
var accessTokenJsonObj = JSON.stringify(tokens);
oauth2Client.setCredentials({
access_token: tokens.access_token,
refresh_token: tokens.refresh_token
});
plus.people.get({ userId: 'me', auth: oauth2Client }, function(err, response) {
// handle err and response
if(!err) {
}
}
}
通过查看谷歌文档,我得到了以下详细信息。
每个用户限制:5 个请求/秒/用户
对于基于 OAuth 的身份验证针对多个用户
,每天是否有任何 API 速率限制谢谢
【问题讨论】:
标签: node.js google-api google-plus google-oauth