如何获得长时间的bigquery API令牌? [英] How to get a long duration of the bigquery API's Token?

查看:207
本文介绍了如何获得长时间的bigquery API令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用bigquery API,我的问题是如何获得长时间的access_token,请注意,它总是只有一小时
如何管理它?
如何避免每一个小时我必须检索一个新的令牌?
是API credentiel可以代替令牌吗?如果是的话如何管理范围?
非常感谢您的回复

解决方案

访问令牌的短生命周期是无法实现的;没有办法告诉Google给我一个持续超过一个小时的访问令牌。访问令牌应该是临时的。



因此,访问令牌将在一段时间后过期。用户/应用程序需要再次进行身份验证才能从Google获取新的访问令牌。



如果您的应用程序需要在单一生命周期内访问Google API访问令牌时,它可以获得一个刷新令牌。因此,用户/应用程序将不得不从Google获得长期的刷新令牌,并将其存储在服务器上的某个安全位置。

详细了解刷新访问令牌:
https://developers.google.com/identity/protocols/OAuth2


I work with bigquery API, and my question is how to get a long duration of the access_token, cauz it's always just for one hour How to manage it? how to avoid the way that every one hour I have to retrieve a new token? is the API credentiel could replace the token? if yes how to manage the scope? Thank you so much for your replies

解决方案

There is no way around the short-life span of the access token; there is no way to tell Google to give me an access token that will last more than about an hour. Access token is meant to be temporary.

So, the access token is going to expire after some time. And the user/app will need to get authenticated again to obtain a new access token from Google.

If your app needs access to a Google API beyond the lifetime of a single access token, it can obtain a refresh token. So, the user/app will have to obtain a long-term "refresh token" from Google, store it somewhere safe on the server.

Read more about Refresh the Access Token: https://developers.google.com/identity/protocols/OAuth2

这篇关于如何获得长时间的bigquery API令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆