Expose oauth2Scopes on Connector instead of AccessSource

The AccessSource.oauth2Scopes field duplicated knowledge that
naturally belongs on the Connector object that AccessSource
already exposes via its connector field. Move it to Connector so
every type that holds a connector (AccessSource, SCIMBridge, etc.)
can reach the scopes through the connector relationship.

AccessSourceRow now queries accessSource.connector { oauth2Scopes }
in its reconnect flow.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-04-08 09:09:08 +02:00
parent 53d6ab09cb
commit ec42409219
3 changed files with 19 additions and 30 deletions

View File

@@ -44,8 +44,8 @@ const fragment = graphql`
connectorId
connector {
provider
oauth2Scopes
}
oauth2Scopes
connectionStatus
selectedOrganization
needsConfiguration
@@ -206,15 +206,15 @@ export function AccessSourceRow({ fKey, connectionId, organizationId }: Props) {
};
const handleReconnect = () => {
const provider = accessSource.connector?.provider;
if (!provider || !accessSource.connectorId) return;
const connector = accessSource.connector;
if (!connector || !accessSource.connectorId) return;
const baseURL = import.meta.env.VITE_API_URL || window.location.origin;
const url = new URL("/api/console/v1/connectors/initiate", baseURL);
url.searchParams.append("organization_id", organizationId);
url.searchParams.append("provider", provider);
url.searchParams.append("provider", connector.provider);
url.searchParams.append("connector_id", accessSource.connectorId);
for (const scope of accessSource.oauth2Scopes) {
for (const scope of connector.oauth2Scopes) {
url.searchParams.append("scope", scope);
}
url.searchParams.append(