Mangopay / mangopay2-php-sdk

PHP SDK for MANGOPAY
https://packagist.org/packages/mangopay/php-sdk-v2
MIT License
122 stars 133 forks source link

ClientId in authentication url #576

Closed qdequippe closed 1 year ago

qdequippe commented 1 year ago
Q A
Version  3.16.2

Hi,

With the addition of $clientIdRequired to GetObject and to RestTool all authentication requests are prefixed the clientId.

This cause authentication errors and all requests failed.

http://localhost/v2.01/test/oauth/token

Steps to reproduce

  1. Clone this repository
  2. Add var_dump($this->_requestUrl) in MangoPay\Libraries\RestTool.php line 182 (see example below)
  3. Run tests
# MangoPay\Libraries\RestTool.php line 182

private function BuildRequest($urlMethod, $pagination, $additionalUrlParams = null, $idempotencyKey = null)
{
    $urlTool = new UrlTool($this->_root);
    $restUrl = $urlTool->GetRestUrl($urlMethod, $this->_clientIdRequired, $pagination, $additionalUrlParams);
    $this->_requestUrl = $urlTool->GetFullUrl($restUrl);
    var_dump($this->_requestUrl);
    ....

Actual result

$ ./vendor/bin/phpunit

PHPUnit 9.5.26 by Sebastian Bergmann and contributors.

.string(67) "https://api.sandbox.mangopay.com/v2.01/sdk-unit-tests/users/natural"
string(66) "https://api.sandbox.mangopay.com/v2.01/sdk-unit-tests/oauth/token/"
string(87) "https://api.sandbox.mangopay.com/v2.01/sdk-unit-tests/users/155912793/bankaccounts/iban"
...
qdequippe commented 1 year ago

A workaround is to use version 3.14.1 of this sdk.

fredericdelordm commented 1 year ago

Hello @qdequippe, we are looking into it