Skip to content

Commit

Permalink
Revert callback URI change for cpTrigger = null (for detached CPs)
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Jul 15, 2024
1 parent 49642bc commit ac0364d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/SocialLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private function _registerCpRoutes(): void
$event->rules['social-login/settings/providers'] = 'social-login/providers';
$event->rules['social-login/settings/providers/edit/<handle:{handle}>'] = 'social-login/providers/edit';

if (Craft::$app->getConfig()->getGeneral()->headlessMode || !Craft::$app->getConfig()->getGeneral()->cpTrigger) {
if (Craft::$app->getConfig()->getGeneral()->headlessMode) {
$event->rules['social-login/auth/callback'] = 'social-login/auth/callback';
}
});
Expand Down
4 changes: 2 additions & 2 deletions src/base/OAuthProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public function getRedirectUri(): ?string

$siteId = Craft::$app->getSites()->getCurrentSite()->id ?? Craft::$app->getSites()->getPrimarySite()->id;

// Check for Headless Mode and use the Action URL, or when `cpTrigger` is empty to signify split front/back-end
if ($generalConfig->headlessMode || !$generalConfig->cpTrigger) {
// Check for Headless Mode and use the Action URL
if ($generalConfig->headlessMode) {
// Don't use the `cpUrl` or `actionUrl` helpers, which include the `cpTrigger`, and that won't work when
// trying to login via the CP. Instead, use the action endpoint, but manually constructed.
return rtrim(UrlHelper::baseCpUrl(), '/') . '/' . rtrim($generalConfig->actionTrigger, '/') . '/social-login/auth/callback';
Expand Down

0 comments on commit ac0364d

Please sign in to comment.