File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -75,10 +75,11 @@ export function clientRegistrationHandler({
7575 }
7676
7777 const clientMetadata = parseResult . data ;
78+ const isPublicClient = clientMetadata . token_endpoint_auth_method !== 'none'
7879
7980 // Generate client credentials
8081 const clientId = crypto . randomUUID ( ) ;
81- const clientSecret = clientMetadata . token_endpoint_auth_method !== 'none'
82+ const clientSecret = isPublicClient
8283 ? crypto . randomBytes ( 32 ) . toString ( 'hex' )
8384 : undefined ;
8485 const clientIdIssuedAt = Math . floor ( Date . now ( ) / 1000 ) ;
@@ -88,7 +89,11 @@ export function clientRegistrationHandler({
8889 client_id : clientId ,
8990 client_secret : clientSecret ,
9091 client_id_issued_at : clientIdIssuedAt ,
91- client_secret_expires_at : clientSecretExpirySeconds > 0 ? clientIdIssuedAt + clientSecretExpirySeconds : 0
92+ client_secret_expires_at : isPublicClient
93+ ? clientSecretExpirySeconds > 0
94+ ? clientIdIssuedAt + clientSecretExpirySeconds
95+ : 0
96+ : undefined ,
9297 } ;
9398
9499 clientInfo = await clientsStore . registerClient ! ( clientInfo ) ;
You can’t perform that action at this time.
0 commit comments