diff --git a/lib/Uphold/HttpClient/Handler/ErrorHandler.php b/lib/Uphold/HttpClient/Handler/ErrorHandler.php index e388585..6765a1d 100644 --- a/lib/Uphold/HttpClient/Handler/ErrorHandler.php +++ b/lib/Uphold/HttpClient/Handler/ErrorHandler.php @@ -92,7 +92,7 @@ protected function onRequestException(RequestException $e) } if (401 === $statusCode) { - $otp = (string) $response->getHeader('X-Bitreserve-OTP'); + $otp = (string) $response->getHeader('OTP-Token'); if ('required' === $otp) { $description = 'Two factor authentication is enabled on this account'; diff --git a/lib/Uphold/UpholdClient.php b/lib/Uphold/UpholdClient.php index fe24225..cc69146 100644 --- a/lib/Uphold/UpholdClient.php +++ b/lib/Uphold/UpholdClient.php @@ -254,7 +254,7 @@ public function createToken($login, $password, $description, $otp = null) { $headers = array_merge($this->getDefaultHeaders(), array( 'Authorization' => sprintf('Basic %s', base64_encode(sprintf('%s:%s', $login, $password))), - 'X-Bitreserve-OTP' => $otp, + 'OTP-Token' => $otp, )); $response = $this->post('/me/tokens', diff --git a/test/Uphold/Tests/Unit/HttpClient/Handler/ErrorHandlerTest.php b/test/Uphold/Tests/Unit/HttpClient/Handler/ErrorHandlerTest.php index fbd63e5..62c912f 100644 --- a/test/Uphold/Tests/Unit/HttpClient/Handler/ErrorHandlerTest.php +++ b/test/Uphold/Tests/Unit/HttpClient/Handler/ErrorHandlerTest.php @@ -130,7 +130,7 @@ public function shouldThrowAuthenticationRequiredExceptionWhenStatusCodeIs401() $response ->expects($this->once()) ->method('getHeader') - ->with('X-Bitreserve-OTP') + ->with('OTP-Token') ->will($this->returnValue(null)) ; @@ -156,7 +156,7 @@ public function shouldThrowTwoFactorAuthenticationRequiredExceptionWhenStatusCod $response ->expects($this->once()) ->method('getHeader') - ->with('X-Bitreserve-OTP') + ->with('OTP-Token') ->will($this->returnValue('required')) ; diff --git a/test/Uphold/Tests/Unit/UpholdClientTest.php b/test/Uphold/Tests/Unit/UpholdClientTest.php index 578b660..ac6a8cb 100644 --- a/test/Uphold/Tests/Unit/UpholdClientTest.php +++ b/test/Uphold/Tests/Unit/UpholdClientTest.php @@ -463,7 +463,7 @@ public function shouldCreateToken() $headers = array( 'Authorization' => sprintf('Basic %s', base64_encode(sprintf('%s:%s', $login, $password))), - 'X-Bitreserve-OTP' => $otp, + 'OTP-Token' => $otp, ); $data = array('foo' => 'bar'); @@ -504,7 +504,7 @@ public function shouldCreateTokenWithOTP() $headers = array( 'Authorization' => sprintf('Basic %s', base64_encode(sprintf('%s:%s', $login, $password))), - 'X-Bitreserve-OTP' => $otp, + 'OTP-Token' => $otp, ); $data = array('foo' => 'bar');