Google OAuth 2.0 for Devices "expires_in", "interval" 是什么意思?
What does Google OAuth 2.0 for Devices "expires_in", "interval" mean?
在 google 的开发者页面 https://developers.google.com/identity/protocols/OAuth2ForDevices 上,它指出:
{
"device_code" : "4/4-GMMhmHCXhWEzkobqIHGG_EnNYYsAkukHspeYUk9E8",
"user_code" : "GQVQ-JKEC",
"verification_url" : "https://www.google.com/device",
"expires_in" : 1800,
"interval" : 5
}
成功请求用户代码后返回。
当它说 expires_in 为“1800”时,它是指分钟还是小时?什么是间隔?我尝试阅读所有 Google material 但我没有找到关于这两者的更多详细信息。
更新
至于间隔我没仔细看,在同一页上写着:
Your application should repeat these requests at the rate that does not exceed the value of interval field.
所以间隔是我必须轮询 google 服务器的速率,以检查用户是否已使用用户代码授权。也许我也错过了 expires_in 变量是什么。
在这样的系统中,目标是让用户看到您系统中的代码并将其输入到他们自己的网页中。
如您所述,interval
是您可以与 Google 检查用户是否已批准您的请求的频率。
expires_in
似乎让您知道用户必须在多长时间内完成此操作,之后尝试登录失败。这并没有直接说明,但它与后来的令牌响应的 expires_in
相似,强烈表明这就是它的工作原理。
在 google 的开发者页面 https://developers.google.com/identity/protocols/OAuth2ForDevices 上,它指出:
{
"device_code" : "4/4-GMMhmHCXhWEzkobqIHGG_EnNYYsAkukHspeYUk9E8",
"user_code" : "GQVQ-JKEC",
"verification_url" : "https://www.google.com/device",
"expires_in" : 1800,
"interval" : 5
}
成功请求用户代码后返回。 当它说 expires_in 为“1800”时,它是指分钟还是小时?什么是间隔?我尝试阅读所有 Google material 但我没有找到关于这两者的更多详细信息。
更新
至于间隔我没仔细看,在同一页上写着:
Your application should repeat these requests at the rate that does not exceed the value of interval field.
所以间隔是我必须轮询 google 服务器的速率,以检查用户是否已使用用户代码授权。也许我也错过了 expires_in 变量是什么。
在这样的系统中,目标是让用户看到您系统中的代码并将其输入到他们自己的网页中。
如您所述,interval
是您可以与 Google 检查用户是否已批准您的请求的频率。
expires_in
似乎让您知道用户必须在多长时间内完成此操作,之后尝试登录失败。这并没有直接说明,但它与后来的令牌响应的 expires_in
相似,强烈表明这就是它的工作原理。