Skip to content

Commit 7808d6b

Browse files
committed
Replaced the authentication methods
Fixed upsert products API URL
1 parent 70d13a9 commit 7808d6b

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

src/Api/AuthenticationApi.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,8 @@ public function __construct(HttpClient $httpClient, UriGeneratorInterface $uriGe
4343
public function authenticateByPassword($clientId, $secret, $username, $password)
4444
{
4545
$requestBody = [
46-
'grant_type' => 'password',
47-
'username' => $username,
46+
'email' => $username,
4847
'password' => $password,
49-
'client_id' => $clientId,
50-
'client_secret' => $secret,
5148
];
5249

5350
return $this->authenticate($requestBody);

src/Api/ProductsApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function create($code, array $data = [])
5353

5454
public function upsert($code, array $data = [])
5555
{
56-
return $this->resourceClient->upsertResource(static::ENDPOINTS_URI, [$code], $data);
56+
return $this->resourceClient->upsertResource(static::ENDPOINT_URI, [$code], $data);
5757
}
5858

5959
/**

src/Client/AuthenticatedHttpClient.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ public function sendRequest($httpMethod, $uri, array $headers = [], $body = null
6767
);
6868

6969
$this->authentication
70-
->setAccessToken($tokens['access_token'])
71-
->setRefreshToken($tokens['refresh_token'])
70+
->setAccessToken($tokens['token'])
7271
;
7372
}
7473

@@ -83,8 +82,7 @@ public function sendRequest($httpMethod, $uri, array $headers = [], $body = null
8382
);
8483

8584
$this->authentication
86-
->setAccessToken($tokens['access_token'])
87-
->setRefreshToken($tokens['refresh_token'])
85+
->setAccessToken($tokens['token'])
8886
;
8987

9088
$headers['Authorization'] = sprintf('Bearer %s', $this->authentication->getAccessToken());

0 commit comments

Comments
 (0)