Skip to main content

此版本的 GitHub Enterprise 已停止服务 2022-10-12. 即使针对重大安全问题,也不会发布补丁。 为了获得更好的性能、更高的安全性和新功能,请升级到最新版本的 GitHub Enterprise。 如需升级帮助,请联系 GitHub Enterprise 支持

Token expiration and revocation

Your tokens can expire and can also be revoked by you, applications you have authorized, and GitHub Enterprise Server itself.

When a token has been revoked, it can no longer be used to authenticate Git and API requests. It is not possible to restore an expired or revoked token, you or the application will need to create a new token.

This article explains the possible reasons your GitHub Enterprise Server token might be revoked or expire.

Note: When a personal access token or OAuth token expires or is revoked, you may see an oauth_authorization.destroy action in your security log. For more information, see "Reviewing your security log."

Token revoked by the user

You can revoke your authorization of a GitHub App or OAuth App from your account settings which will revoke any tokens associated with the app. For more information, see "Reviewing your authorized integrations" and "Reviewing your authorized applications (OAuth)."

Once an authorization is revoked, any tokens associated with the authorization will be revoked as well. To re-authorize an application, follow the instructions from the third-party application or website to connect your account on your GitHub Enterprise Server instance again.

Token revoked by the OAuth App

The owner of an OAuth App can revoke an account's authorization of their app, this will also revoke any tokens associated with the authorization. For more information about revoking authorizations of your OAuth app, see "Delete an app authorization."

OAuth App owners can also revoke individual tokens associated with an authorization. For more information about revoking individual tokens for your OAuth app, see "Delete an app token".

Token revoked due to excess of tokens for an OAuth App with the same scope

每个用户/应用程序/作用域组合签发的令牌数量有限。 如果应用程序为同一用户和相同作用域创建超过 10 个令牌,则将撤销具有相同用户/应用程序/作用域组合的最旧令牌。

User token revoked due to GitHub App configuration

User-to-server tokens created by a GitHub App will expire after eight hours by default. Owners of GitHub Apps can configure their apps so that user-to-server tokens do not expire. For more information about changing how your GitHub App's user-to-server tokens behave, see "Activating optional features for apps."