Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@JasonTolliver
Copy link
Contributor

This moves the currently hardcoded getAccessTokenResponse into their own method. This allows children providers to construct their own headers as needed.

A perfect example of the necessity of this feature is the newer Pinterest v5 API. In order to exchange the code for an access token, they require an Authorization header composed of a base64 encoded client_id and client_secret. Without this change, the Pinterest Provider would need to entirely reimplement the getAccessTokenResponse method. With this change, the Pinterest Provider could simply:

protected function getTokenHeaders()
{
    return array_merge(
        parent::getTokenHeaders(),
        [
            'Authorization' => 'Basic ' . base64_encode("{$this->clientId}:{$this->clientSecret}"),
        ]
    );
}

JasonTolliver and others added 2 commits August 19, 2022 11:53
This moves the currently hardcoded `getAccessTokenResponse` into their own method.  This allows children providers to construct their own headers as needed.

A perfect example of the necessity of this feature is the newer Pinterest v5 API.  In order to exchange the code for an access token, they require an `Authorization` header composed of a base64 encoded `client_id` and `client_secret`.  Without this change, the Pinterest Provider would need to entirely reimplement the `getAccessTokenResponse` method.  **With** this change, the Pinterest Provider could simply:

```php
protected function getTokenHeaders()
{
    return array_merge(
        parent::getTokenHeaders(),
        [
            'Authorization' => 'Basic ' . base64_encode("{$this->clientId}:{$this->clientSecret}"),
        ]
    );
}
```
@taylorotwell taylorotwell merged commit ce8b2f9 into laravel:5.x Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants