Сервис qbo_auth: OAuth-токены QuickBooks Online (callback services/api/qbo/callback), исследование и предложение quickbooks_bookkeeper (п.84)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
20
packages/khb_common/migrations/031_qbo_connection.sql
Normal file
20
packages/khb_common/migrations/031_qbo_connection.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- Подключение к QuickBooks Online (сервис qbo_auth): токены приложения и одноразовые state авторизации.
|
||||
-- Токены хранятся зашифрованными (AES-256-GCM, ключ qbo_auth.encryptionKey в settings.json5), не в открытом виде.
|
||||
create table if not exists qbo_connection (
|
||||
environment text primary key check (environment in ('sandbox', 'production')),
|
||||
realm_id text not null, -- идентификатор компании QuickBooks
|
||||
access_token_enc text not null,
|
||||
refresh_token_enc text not null,
|
||||
access_expires_at timestamptz not null, -- access token живёт 60 минут
|
||||
refresh_expires_at timestamptz not null, -- refresh token скользящий, до 100 дней
|
||||
authorized_at timestamptz not null, -- когда администратор дал согласие
|
||||
refreshed_at timestamptz not null,
|
||||
status text not null default 'ok' check (status in ('ok', 'reauth_needed'))
|
||||
);
|
||||
create table if not exists qbo_oauth_state (
|
||||
state text primary key,
|
||||
environment text not null check (environment in ('sandbox', 'production')),
|
||||
created_at timestamptz not null default now()
|
||||
);
|
||||
alter table qbo_connection enable row level security;
|
||||
alter table qbo_oauth_state enable row level security;
|
||||
Reference in New Issue
Block a user