Skip to content

Commit

Permalink
Add support legacy simple auth
Browse files Browse the repository at this point in the history
  • Loading branch information
crazybee69 committed Dec 30, 2023
1 parent 9004649 commit 076b338
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "crazybee47/laravel-bitrix24",
"description": "Laravel wrapper around OAuth2 Bitrix24 Rest API Application",
"type": "library",
"version": "1.0.9.7",
"version": "1.0.9.8",
"license": "MIT",
"require": {
"php": "^8.1",
Expand Down
8 changes: 8 additions & 0 deletions src/Feature/OauthAuthorizable.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,25 @@
use GuzzleHttp\RequestOptions;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;

trait OauthAuthorizable
{
public function authorizeRequest(array $request): void
{
$event = $request['event'] ?? null;
if ($event === EventTypeEnum::OnAppInstall->value) {
$isSimpleAuth = Arr::has($request, 'AUTH_ID');
if ($isSimpleAuth) {
$redirectUrl = route('bitrix.oauth.redirect');
Log::warning("[BitrixService] Authorization error. Bitrix24 use simple auth. You must authorize by redirect url: {$redirectUrl}");
return;
}
$authData = $request['auth'];
$this->saveOauthData($authData);
return;
}

$code = $request['code'] ?? null;
$serverDomain = $request['server_domain'] ?? 'oauth.bitrix.info';
if ($code !== null) {
Expand Down

0 comments on commit 076b338

Please sign in to comment.