Skip to content

Commit

Permalink
button update
Browse files Browse the repository at this point in the history
  • Loading branch information
bessudnov committed Sep 20, 2019
1 parent cdf6c43 commit a5a09df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions example.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<script
class="amocrm_oauth"
charset="utf-8"
data-client-id="b9bde73d-927e-4f7c-994c-75236076437e"
data-client-id="' . $provider->getClientId() . '"
data-title="Установить интеграцию"
data-compact="false"
data-class-name="className"
Expand All @@ -41,11 +41,12 @@ class="amocrm_oauth"
src="https://www.amocrm.ru/auth/button.min.js"
></script>
</div>';
die;
} else {
$authorizationUrl = $provider->getAuthorizationUrl();
header('Location: ' . $authorizationUrl);
}
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
} elseif (empty($_GET['state']) || empty($_SESSION['oauth2state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
unset($_SESSION['oauth2state']);
exit('Invalid state');
}
Expand Down
8 changes: 8 additions & 0 deletions src/AmoCRM.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ public function getBaseDomain()
return $this->baseDomain;
}

/**
* @return string
*/
public function getClientId()
{
return $this->clientId;
}

/**
* Get authorization url to begin OAuth flow
*
Expand Down

0 comments on commit a5a09df

Please sign in to comment.