File tree Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 6
6
7
7
use Psr \Container \ContainerInterface ;
8
8
use Vonage \Client \APIResource ;
9
+ use Vonage \Client \Credentials \Handler \BasicHandler ;
9
10
use Vonage \Client \Credentials \Handler \BasicQueryHandler ;
10
11
11
12
class ClientFactory
@@ -15,7 +16,7 @@ public function __invoke(ContainerInterface $container): Client
15
16
/** @var APIResource $api */
16
17
$ api = $ container ->make (APIResource::class);
17
18
$ api ->setIsHAL (false );
18
- $ api ->setAuthHandlers (new BasicQueryHandler ());
19
+ $ api ->setAuthHandlers (new BasicHandler ());
19
20
20
21
return new Client ($ api );
21
22
}
Original file line number Diff line number Diff line change 6
6
7
7
use Psr \Container \ContainerInterface ;
8
8
use Vonage \Client \APIResource ;
9
+ use Vonage \Client \Credentials \Handler \BasicHandler ;
9
10
use Vonage \Client \Credentials \Handler \TokenBodyHandler ;
10
11
11
12
class ClientFactory
@@ -18,7 +19,7 @@ public function __invoke(ContainerInterface $container): Client
18
19
->setIsHAL (false )
19
20
->setBaseUri ('/verify ' )
20
21
->setErrorsOn200 (true )
21
- ->setAuthHandlers (new TokenBodyHandler ())
22
+ ->setAuthHandlers (new BasicHandler ())
22
23
->setExceptionErrorHandler (new ExceptionErrorHandler ());
23
24
24
25
return new Client ($ api );
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ public function setUp(): void
52
52
$ this ->api = new APIResource ();
53
53
$ this ->api ->setIsHAL (false );
54
54
$ this ->api ->setClient ($ this ->vonageClient ->reveal ());
55
+ $ this ->api ->setAuthHandlers (new Client \Credentials \Handler \BasicHandler ());
55
56
56
57
$ this ->insightsClient = new InsightsClient ($ this ->api );
57
58
}
Original file line number Diff line number Diff line change @@ -51,22 +51,23 @@ public function setUp(): void
51
51
->setIsHAL (false )
52
52
->setBaseUri ('/verify ' )
53
53
->setErrorsOn200 (true )
54
- ->setAuthHandlers (new Client \Credentials \Handler \TokenBodyHandler ())
54
+ ->setAuthHandlers (new Client \Credentials \Handler \BasicHandler ())
55
55
->setClient ($ this ->vonageClient ->reveal ())
56
56
->setExceptionErrorHandler (new ExceptionErrorHandler ());
57
57
58
58
$ this ->client = new VerifyClient ($ api );
59
59
}
60
60
61
- public function testUsesCorrectAuthInBody (): void
61
+ public function testUsesCorrectAuth (): void
62
62
{
63
63
$ this ->vonageClient ->send (
64
64
Argument::that (
65
65
function (RequestInterface $ request ) {
66
- $ this ->assertRequestJsonBodyContains ('api_key ' , 'abc ' , $ request );
67
- $ this ->assertRequestJsonBodyContains ('api_secret ' , 'def ' , $ request );
68
66
$ this ->assertRequestMatchesUrl ('https://api.nexmo.com/verify/psd2/json ' , $ request );
69
-
67
+ $ this ->assertEquals (
68
+ 'Basic ' ,
69
+ mb_substr ($ request ->getHeaders ()['Authorization ' ][0 ], 0 , 6 )
70
+ );
70
71
return true ;
71
72
}
72
73
)
You can’t perform that action at this time.
0 commit comments