Tag: google oauth

Gmail API是否支持JWT?

我想使用NodeJS访问Gmail API。 我正在使用服务器到服务器的方法(请参阅此 ),但是当我执行下面的代码时,我得到一个backEndError,来自Google API的代码500。 有任何想法吗? var authClient = new google.auth.JWT( 'email', 'key.pem', // Contents of private_key.pem if you want to load the pem file yourself // (do not use the path parameter above if using this param) 'key', // Scopes can be specified either as an array or as a single, space-delimited string ['https://www.googleapis.com/auth/gmail.readonly'] […]

从passportjs中的刷新令牌获取oauth访问令牌

要确定何时使用刷新令牌来请求新的访问令牌,我知道两种方法(下面)。 无需修改passport-google-oauth库,这两种方法都可行吗? 1)“先发制人”的方法 保存授权后的访问令牌的到期时间 每当使用访问令牌访问API时,请根据当前时间检查到期时间 如果访问令牌没有过期,请使用它来访问API 如果访问令牌已过期(或接近过期),请提供刷新令牌以获取新的访问令牌 2)“处理失败”方法 始终提供访问令牌 如果访问令牌未通过身份validation,请提供刷新令牌,以获取新的访问令牌 谢谢。 也欢迎任何替代品。