Skip to content

Commit

Permalink
Talkdesk requires basic auth for the authorization call
Browse files Browse the repository at this point in the history
  • Loading branch information
russianryebread committed Jan 28, 2022
1 parent 3d3eae8 commit 2fcf0f8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Provider/Talkdesk.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct(array $options = [], array $collaborators = [])
*/
public function getBaseAuthorizationUrl()
{
return $this->getAuthDomain() . '/oauth/token';
return $this->getAuthDomain() . '/oauth/authorize';
}

/**
Expand Down Expand Up @@ -161,4 +161,17 @@ private function getAuthDomain()
{
return 'https://' . $this->subdomain . $this->domain;
}

/**
* {@inheritDoc}
*/
public function getHeaders($token = null)
{
if (!$token) {
$auth = base64_encode("{$this->clientId}:{$this->clientSecret}");
$headers["Authorization"] = "Basic $auth";
return array_merge(parent::getHeaders($token), $headers);
}
return parent::getHeaders($token);
}
}

0 comments on commit 2fcf0f8

Please sign in to comment.