ToolJet/server/data-migrations/1760693571486-BackfillMicrosoftGraphDatasourceScopeToHaveOfflineAccessForRefreshToken.ts
Ganesh Kumar 4ede7110d6
Hotfix: Microsoft graph datasource refresh token flow (#14344)
* microsoft graph refresh token flow

* Handled unauthorised error

* marketplace dev mode will be picked from public config

* for microsoft graph when datasource is updated clear the token details

* added migration to backfill values for scope in Microsoft graph datasource

* version bump
2025-10-17 22:11:19 +05:30

15 lines
648 B
TypeScript

import { MigrationInterface, QueryRunner } from 'typeorm';
export class BackfillMicrosoftGraphDatasourceScopeToHaveOfflineAccessForRefreshToken1760693571486
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
UPDATE data_source_options
SET "options" = ("options"::jsonb || '{"scopes": {"value": "https://graph.microsoft.com/.default offline_access", "encrypted": false}}'::jsonb)::json
FROM data_sources ds
WHERE ds.id = data_source_id and ds.kind = 'microsoft_graph'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {}
}