GitLab OAuth 访问令牌有效性

Dre*_*ejc 4 oauth gitlab

有谁知道 GitLab 上 OAuth 访问令牌的有效期是多少?

至少需要 12 小时(根据经验),但我想确定一下,所以我不会不必要地刷新令牌。

PS:GitLab ...如果在获取/刷新令牌时简单地返回到期会非常方便(PS:文档指出“expires_in”:返回......但它不是)

Haw*_*r23 5

来自https://forum.gitlab.com/t/missing-expires-in-in-the-token-response/1232/2

Gitlab 使用 Doorkeeper 进行 oauth。

Doorkeeper wiki 有一个 ariticle "Customizing Token Expiration" > https://github.com/doorkeeper-gem/doorkeeper/wiki/Customizing-Token-Expiration2

这个 wiki 告诉我们一个配置“access_token_expires_in”。我 > 在 gitlab 源代码中搜索并发现它设置为 nil。

这意味着“access_token”永远不会过期。

此外,这是来自https://gitlab.com/gitlab-org/gitlab-foss/-/blob/50d66f5ece57dcfbe074d97703691a8d3c38f4ac/config/initializers/doorkeeper.rb#L42

 # Access token expiration time (default 2 hours).
 # If you want to disable expiration, set this to nil.
 access_token_expires_in nil
Run Code Online (Sandbox Code Playgroud)