Deploy: 2026-05-22 04:05:29
This commit is contained in:
@@ -36,7 +36,6 @@ class SallaController extends BaseController
|
||||
'client_id' => $clientId,
|
||||
'redirect_uri' => $redirectUri,
|
||||
'response_type' => 'code',
|
||||
'scope' => 'read_orders read_customers',
|
||||
'state' => $companyId
|
||||
]);
|
||||
|
||||
@@ -50,6 +49,16 @@ class SallaController extends BaseController
|
||||
*/
|
||||
public function callback(Request $request, Response $response)
|
||||
{
|
||||
// Handle Salla returning an error redirect (e.g. invalid_scope, access_denied)
|
||||
if (!empty($_GET['error'])) {
|
||||
$errorCode = $_GET['error'] ?? 'unknown_error';
|
||||
$errorDesc = $_GET['error_description'] ?? 'An unknown error occurred during Salla authorization.';
|
||||
error_log("[Salla OAuth Error] $errorCode: $errorDesc");
|
||||
$appUrl = rtrim(getenv('APP_URL') ?: 'https://nabeh.intaleqapp.com', '/');
|
||||
header("Location: {$appUrl}/?salla_connect=error&reason=" . urlencode($errorDesc));
|
||||
exit;
|
||||
}
|
||||
|
||||
$code = $_GET['code'] ?? '';
|
||||
$companyId = $_GET['state'] ?? '';
|
||||
|
||||
|
||||
@@ -1603,6 +1603,12 @@
|
||||
? 'تم ربط متجر سلة بنجاح!'
|
||||
: 'Salla store connected successfully!';
|
||||
window.history.replaceState({}, document.title, window.location.pathname);
|
||||
} else if (urlParams.get('salla_connect') === 'error') {
|
||||
const reason = urlParams.get('reason') || '';
|
||||
this.dashboardError = this.lang === 'ar'
|
||||
? 'فشل ربط متجر سلة: ' + reason
|
||||
: 'Salla connection failed: ' + reason;
|
||||
window.history.replaceState({}, document.title, window.location.pathname);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user