fix(vikon): use vikon_core redirect_uri for OAuth (registered on VIKON server)

- vikon_core/update/index.php now redirects OAuth callback to /dashboard/vikon-updates
- Vue frontend sends redirect_uri=https://www.ntspi.ru/vikon_core/update/index.php
- This URL is registered on db-nica.ru for client_id=542
This commit is contained in:
F4ilji
2026-07-04 13:43:42 +05:00
parent 94e17dfbbc
commit 2ccfb24d1d
2 changed files with 15 additions and 2 deletions
+13
View File
@@ -0,0 +1,13 @@
<?php
$code = isset($_GET['code']) ? $_GET['code'] : '';
$state = isset($_GET['state']) ? $_GET['state'] : '';
$query = http_build_query(array_filter([
'code' => $code,
'state' => $state,
]));
$redirectUrl = '/dashboard/vikon-updates' . ($query ? '?' . $query : '');
header('Location: ' . $redirectUrl, true, 302);
exit;
@@ -141,7 +141,7 @@ const versionInfo = ref({ current_version: props.current_version, has_update: fa
const accessInfo = ref({ has_access: false, error: null }); const accessInfo = ref({ has_access: false, error: null });
const authUrl = computed(() => { const authUrl = computed(() => {
const redirect = encodeURIComponent(route('dashboard.vikon-updates.index')); const redirect = encodeURIComponent(`${window.location.origin}/vikon_core/update/index.php`);
return `${props.vikon_api_domain}oauth2/authorize?client_id=${props.vikon_client_id}&redirect_uri=${redirect}&response_type=code`; return `${props.vikon_api_domain}oauth2/authorize?client_id=${props.vikon_client_id}&redirect_uri=${redirect}&response_type=code`;
}); });
@@ -161,7 +161,7 @@ async function authenticate(code) {
try { try {
const res = await axios.post(route('dashboard.vikon-updates.authenticate'), { const res = await axios.post(route('dashboard.vikon-updates.authenticate'), {
code, code,
redirect_uri: window.location.origin + window.location.pathname, redirect_uri: `${window.location.origin}/vikon_core/update/index.php`,
}); });
if (res.data.success) { if (res.data.success) {
isAuthenticated.value = true; isAuthenticated.value = true;