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
5 changes: 5 additions & 0 deletions .changeset/application-response-older-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@seamless-auth/types': patch
---

`OidcApplicationSchema` reads a missing `sessionExchangeEnabled` as `false`. 0.36.0 made the field required, so a client on 0.36.0 refused the application list from any API older than v0.23, which does not send it.
7 changes: 7 additions & 0 deletions src/schemas/oidcApplication/schema.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { describe, it, expect } from 'vitest';
import {
OidcApplicationCreateRequestSchema,
OidcApplicationSchema,
OidcApplicationKeysRequestSchema,
OidcApplicationResourcesRequestSchema,
OidcApplicationUpdateRequestSchema,
Expand Down Expand Up @@ -358,6 +359,12 @@ describe('HostedUiSchema', () => {
});

describe('sessionExchangeEnabled', () => {
it('reads as off from an API older than the session exchange', () => {
const field = OidcApplicationSchema.shape.sessionExchangeEnabled;
expect(field.parse(undefined)).toBe(false);
expect(field.parse(true)).toBe(true);
});

const nativeClient = {
name: 'CLI',
clientType: 'public',
Expand Down
3 changes: 2 additions & 1 deletion src/schemas/oidcApplication/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ export const OidcApplicationSchema = z.object({
grantTypes: z.array(OidcApplicationGrantTypeSchema),
deviceFlowEnabled: z.boolean(),
noticesEnabled: z.boolean(),
sessionExchangeEnabled: z.boolean(),
/** Absent from an API older than v0.23, which has no session exchange. */
sessionExchangeEnabled: z.boolean().default(false),
pkceRequired: z.boolean(),
nonceRequired: z.boolean(),
jwks: OidcApplicationJwksSchema.nullable(),
Expand Down
Loading