From d9d7b588912a6db520dfa7dac9b11cecc7a24628 Mon Sep 17 00:00:00 2001 From: A Porat Date: Thu, 20 Mar 2025 10:21:35 -0400 Subject: [PATCH 1/3] added application/vnd.github.v3+json to request headers --- src/Provider/Github.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Provider/Github.php b/src/Provider/Github.php index 6a44944..eea95dc 100644 --- a/src/Provider/Github.php +++ b/src/Provider/Github.php @@ -3,6 +3,7 @@ namespace League\OAuth2\Client\Provider; use League\OAuth2\Client\Provider\Exception\GithubIdentityProviderException; +use League\OAuth2\Client\Provider\Exception\IdentityProviderException; use League\OAuth2\Client\Token\AccessToken; use League\OAuth2\Client\Tool\BearerAuthorizationTrait; use Psr\Http\Message\ResponseInterface; @@ -118,7 +119,7 @@ protected function checkResponse(ResponseInterface $response, $data) * * @param array $response * @param AccessToken $token - * @return \League\OAuth2\Client\Provider\ResourceOwnerInterface + * @return ResourceOwnerInterface */ protected function createResourceOwner(array $response, AccessToken $token) { @@ -126,4 +127,16 @@ protected function createResourceOwner(array $response, AccessToken $token) return $user->setDomain($this->domain); } + + /** + * Returns the default headers used by this provider. + * + * @return array + */ + protected function getDefaultHeaders(): array + { + return [ + 'Accept' => 'application/vnd.github.v3+json' + ]; + } } From 0e1960cc0342900c6a3fd4db6f79e09d53ccc164 Mon Sep 17 00:00:00 2001 From: A Porat Date: Thu, 20 Mar 2025 10:23:24 -0400 Subject: [PATCH 2/3] added recent PHP version to CI, depbot, minor README cleanup --- .github/dependabot.yml | 13 +++++++++++++ .github/workflows/ci.yaml | 9 ++++++--- README.md | 9 ++++----- 3 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2e0b58c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + # Check for updates to GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + + # Maintain dependencies for Composer + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7876eee..1182cf6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,6 +15,9 @@ jobs: - '7.3' - '7.4' - '8.0' + - '8.2' + - '8.3' + - '8.4' minimum_versions: [false] coverage: ['none'] include: @@ -22,15 +25,15 @@ jobs: php: '7.3' minimum_versions: true - description: 'Log Code Coverage' - php: '7.4' + php: '8.4' coverage: 'xdebug' name: PHP ${{ matrix.php }} ${{ matrix.description }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: ~/.composer/cache/files key: ${{ matrix.php }} diff --git a/README.md b/README.md index f55cd37..3f96bcc 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ -# Github Provider for OAuth 2.0 Client +# GitHub Provider for OAuth 2.0 Client [![Latest Version](https://img.shields.io/github/release/thephpleague/oauth2-github.svg?style=flat-square)](https://github.com/thephpleague/oauth2-github/releases) -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) -[![Build Status](https://img.shields.io/travis/thephpleague/oauth2-github/master.svg?style=flat-square)](https://travis-ci.org/thephpleague/oauth2-github) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) [![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/thephpleague/oauth2-github.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/oauth2-github/code-structure) [![Quality Score](https://img.shields.io/scrutinizer/g/thephpleague/oauth2-github.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/oauth2-github) [![Total Downloads](https://img.shields.io/packagist/dt/league/oauth2-github.svg?style=flat-square)](https://packagist.org/packages/league/oauth2-github) -This package provides Github OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client). +This package provides GitHub OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client). ## Installation @@ -72,7 +71,7 @@ if (!isset($_GET['code'])) { ### Managing Scopes -When creating your Github authorization URL, you can specify the state and scopes your application may authorize. +When creating your GitHub authorization URL, you can specify the state and scopes your application may authorize. ```php $options = [ From 21233a744cbf6ebf0c65ecd311c4c025db236666 Mon Sep 17 00:00:00 2001 From: A Porat Date: Thu, 20 Mar 2025 10:28:21 -0400 Subject: [PATCH 3/3] added application/vnd.github+json in request headers --- src/Provider/Github.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Provider/Github.php b/src/Provider/Github.php index eea95dc..8daa862 100644 --- a/src/Provider/Github.php +++ b/src/Provider/Github.php @@ -136,7 +136,7 @@ protected function createResourceOwner(array $response, AccessToken $token) protected function getDefaultHeaders(): array { return [ - 'Accept' => 'application/vnd.github.v3+json' + 'Accept' => 'application/vnd.github+json' ]; } }