Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnose command: Add GitHub OAuth token expiration date information #11688

Merged
merged 2 commits into from
Feb 7, 2024
Merged

Diagnose command: Add GitHub OAuth token expiration date information #11688

merged 2 commits into from
Feb 7, 2024

Commits on Feb 7, 2024

  1. Diagnose command: Add GitHub OAuth token expiration date information

    GitHub's new fine-grained tokens have a cumpulsory expiration date, and their
    classic tokens also support an expiration date.
    
    https://github.blog/changelog/2021-07-26-expiration-options-for-personal-access-tokens/
    
    This improves the `composer diagnose` command to display the expiration
    date and time if it is provided by the response headers
    (via `GitHub-Authentication-Token-Expiration`).
    
    The `DateTime::createFromFormat` call is used to validate the expected date
    format. It accounts for all the possible issued with the datetime extension
    by catching `\Throwable` exceptions. This can be fine-tuned in the future
    by narrowing the catched scopes to `\ValueError`, or the new granualar
    [exceptions in PHP >= 8.3](https://php.watch/versions/8.3/datetime-exceptions)
    Ayesh committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    cd2d68f View commit details
    Browse the repository at this point in the history
  2. Keep things simpler in case the response header format changes, we do…

    … not need to marry a date format here
    Seldaek committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    c2bc8eb View commit details
    Browse the repository at this point in the history