From 9f23b2faf576c7e5fbcd5554941b31162cea7159 Mon Sep 17 00:00:00 2001 From: Richard Henkenjohann Date: Sun, 20 Jan 2019 17:19:15 +0100 Subject: [PATCH] Add the Authorization header Add the Authorization header on access token request. --- src/Provider/Newsletter2Go.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Provider/Newsletter2Go.php b/src/Provider/Newsletter2Go.php index c90a426..3d6c1d4 100644 --- a/src/Provider/Newsletter2Go.php +++ b/src/Provider/Newsletter2Go.php @@ -3,11 +3,11 @@ /** * This file is part of richardhj/oauth2-newsletter2go. * - * Copyright (c) 2016-2018 Richard Henkenjohann + * Copyright (c) 2016-2019 Richard Henkenjohann * * @package richardhj/oauth2-newsletter2go * @author Richard Henkenjohann - * @copyright 2016-2018 Richard Henkenjohann + * @copyright 2016-2019 Richard Henkenjohann * @license https://github.com/richardhj/oauth2-newsletter2go/blob/master/LICENSE LGPL-3.0 */ @@ -197,6 +197,21 @@ public function getAccessToken($grant, array $options = []) return parent::getAccessToken($grant, $options); } + /** + * {@inheritdoc} + */ + protected function getAccessTokenRequest(array $params) + { + $method = $this->getAccessTokenMethod(); + $url = $this->getAccessTokenUrl($params); + $options = $this->optionProvider->getAccessTokenOptions($this->getAccessTokenMethod(), $params); + + $encodedCredentials = base64_encode($this->authKey); + $options['headers']['Authorization'] = 'Basic ' . $encodedCredentials; + + return $this->getRequest($method, $url, $options); + } + /** * Checks a provider response for errors. *