Skip to content

Commit

Permalink
App minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
NetoBraghetto committed Dec 9, 2022
1 parent 66e9ab9 commit 52cfe0c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Braghetto/Hokoml/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,13 @@ public function __construct(HttpClientInterface $http_client, $app_id, $secret_k
*
* @return string
*/
public function getAuthUrl($redirect_uri = null)
public function getAuthUrl($redirect_uri = null, $merge = [])
{
$params = [
$params = array_merge([
'client_id' => $this->app_id,
'response_type' => 'code',
'redirect_uri' => isset($redirect_uri) ? $redirect_uri : $this->redirect_uri,

];
], $merge);
return $this->auth_urls[$this->country] . '/authorization?' . http_build_query($params);
}

Expand All @@ -131,15 +130,16 @@ public function getAuthUrl($redirect_uri = null)
*
* @return array
*/
public function authorize($code)
public function authorize($code, $merge = [])
{
$data = [
$data = array_merge([
'grant_type' => 'authorization_code',
'client_id' => $this->app_id,
'client_secret' => $this->secret_key,
'code' => $code,
'redirect_uri' => $this->redirect_uri
];
], $merge);

$response = $this->http->post($this->api_url . '/oauth/token?' . http_build_query($data));
$this->resetAccessTokenAndSellerId($response);
return $response;
Expand All @@ -150,14 +150,14 @@ public function authorize($code)
*
* @return array
*/
public function refreshAccessToken($refresh_token)
public function refreshAccessToken($refresh_token, $merge = [])
{
$data = [
$data = array_merge([
'grant_type' => 'refresh_token',
'client_id' => $this->app_id,
'client_secret' => $this->secret_key,
'refresh_token' => $refresh_token
];
], $merge);
$response = $this->http->post($this->api_url . '/oauth/token', $data);
$this->resetAccessTokenAndSellerId($response);
return $response;
Expand Down

0 comments on commit 52cfe0c

Please sign in to comment.