Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"url": "https://api.workos.com/data-integrations/q2czJKmVAraSBg8xFpT7M9uR/authorize-redirect",
"state": "01K8ZQ6Y3J4N5P7R9T2V4W6X8Z",
"completion": "finish_required"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
export interface DataIntegrationAuthorizeUrlResponse {
/** The OAuth authorization URL to redirect the user to. */
url: string;
/** Identifies this authorization. WorkOS adds it to `return_to` alongside `connect_code` or `error`. Store it in the user's session with the `code_verifier` and compare it when the user returns. */
state?: string;
/** `finish_required` when the request included `code_challenge`: the connection will be held until your app finishes it. Omitted otherwise. If you sent `code_challenge` and this is missing, don't redirect the user. */
completion?: 'finish_required';
}

export interface DataIntegrationAuthorizeUrlResponseWire {
url: string;
state?: string;
completion?: 'finish_required';
}
1 change: 1 addition & 0 deletions src/pipes/pipes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ describe('Pipes', () => {
expect(result.url).toBe(
'https://api.workos.com/data-integrations/q2czJKmVAraSBg8xFpT7M9uR/authorize-redirect',
);
expect(result.state).toBe('01K8ZQ6Y3J4N5P7R9T2V4W6X8Z');
});

it('sends the code challenge and returns the completion mode', async () => {
Expand Down
6 changes: 5 additions & 1 deletion src/pipes/serializers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ describe('DataIntegrationAuthorizeUrlResponseSerializer', () => {
dataIntegrationAuthorizeUrlResponseFixture as DataIntegrationAuthorizeUrlResponseWire;
const deserialized =
deserializeDataIntegrationAuthorizeUrlResponse(fixture);
expect(deserialized).toBeDefined();
expect(deserialized).toEqual({
url: fixture.url,
state: fixture.state,
completion: fixture.completion,
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ export const deserializeDataIntegrationAuthorizeUrlResponse = (
response: DataIntegrationAuthorizeUrlResponseWire,
): DataIntegrationAuthorizeUrlResponse => ({
url: response.url,
state: response.state ?? '',
completion: response.completion,
});
Loading