fix client id issuance date should only be sent when generated (#775)

This commit is contained in:
Christian Daguerre 2025-07-17 19:51:51 +02:00 • committed by GitHub
commit 2db0dbebe7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 2 deletions

View file

@ -16,5 +16,5 @@ export interface OAuthRegisteredClientsStore {
*
* If unimplemented, dynamic client registration is unsupported.
*/
registerClient?(client: Omit<OAuthClientInformationFull, "client_id">): OAuthClientInformationFull | Promise<OAuthClientInformationFull>;
registerClient?(client: Omit<OAuthClientInformationFull, "client_id" | "client_id_issued_at">): OAuthClientInformationFull | Promise<OAuthClientInformationFull>;
}

View file

@ -236,6 +236,7 @@ describe('Client Registration Handler', () => {
expect(response.status).toBe(201);
expect(response.body.client_id).toBeUndefined();
expect(response.body.client_id_issued_at).toBeUndefined();
});
it('handles client with all metadata fields', async () => {

View file

@ -99,12 +99,12 @@ export function clientRegistrationHandler({
let clientInfo: Omit<OAuthClientInformationFull, "client_id"> & { client_id?: string } = {
...clientMetadata,
client_secret: clientSecret,
client_id_issued_at: clientIdIssuedAt,
client_secret_expires_at: clientSecretExpiresAt,
};
if (clientIdGeneration) {
clientInfo.client_id = crypto.randomUUID();
clientInfo.client_id_issued_at = clientIdIssuedAt;
}
clientInfo = await clientsStore.registerClient!(clientInfo);