Skip to content

Commit

Permalink
fix: high level window config (#1328)
Browse files Browse the repository at this point in the history
  • Loading branch information
atymic authored Jan 28, 2025
1 parent 09b8a55 commit e03d25a
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/GoHighLevel/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,24 @@ class Provider extends AbstractProvider

protected $scopes = ['users.readonly'];

protected bool $sameWindow = true;

protected function getAuthUrl($state): string
{
return $this->buildAuthUrlFromBase('https://marketplace.leadconnectorhq.com/oauth/chooselocation', $state);
}

protected function getCodeFields($state = null)
{
$fields = parent::getCodeFields($state);

if ($this->sameWindow) {
$fields['loginWindowOpenMode'] = 'self';
}

return $fields;
}

protected function getTokenUrl(): string
{
return 'https://services.leadconnectorhq.com/oauth/token';
Expand All @@ -39,7 +52,7 @@ protected function getUserByToken($token)
$response = $this->getHttpClient()->get('https://services.leadconnectorhq.com/users/' . $userId, [
'headers' => [
'Authorization' => 'Bearer ' . $token,
'Version' => '2021-07-28'
'Version' => '2021-07-28',
],
]);

Expand Down Expand Up @@ -87,4 +100,11 @@ public function refreshToken($refreshToken)

return json_decode((string) $response->getBody(), true);
}

public function inSameWindow(bool $sameWindow = true): self
{
$this->sameWindow = $sameWindow;

return $this;
}
}

0 comments on commit e03d25a

Please sign in to comment.