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 = [ diff --git a/src/Provider/Github.php b/src/Provider/Github.php index 6a44944..8daa862 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+json' + ]; + } }