1.3. 保持离线令牌处于活跃状态

当应用程序需要代表用户执行操作时,即使用户离线,则保持离线令牌处于活跃状态时很有用。例如,常规数据备份。

离线令牌在 30 天不活动后过期。您可以通过刷新离线令牌来保持离线令牌。

注意

离线令牌过期后,您必须请求一个新令牌。

定期运行以下命令防止您的令牌过期:

curl https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token -d grant_type=refresh_token -d client_id="cloud-services" -d refresh_token="{{ user_token }}" --fail --silent --show-error --output /dev/null