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({
75
75
}
76
76
77
77
const clientMetadata = parseResult . data ;
78
+ const isPublicClient = clientMetadata . token_endpoint_auth_method !== 'none'
78
79
79
80
// Generate client credentials
80
81
const clientId = crypto . randomUUID ( ) ;
81
- const clientSecret = clientMetadata . token_endpoint_auth_method !== 'none'
82
+ const clientSecret = isPublicClient
82
83
? crypto . randomBytes ( 32 ) . toString ( 'hex' )
83
84
: undefined ;
84
85
const clientIdIssuedAt = Math . floor ( Date . now ( ) / 1000 ) ;
@@ -88,7 +89,11 @@ export function clientRegistrationHandler({
88
89
client_id : clientId ,
89
90
client_secret : clientSecret ,
90
91
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 ,
92
97
} ;
93
98
94
99
clientInfo = await clientsStore . registerClient ! ( clientInfo ) ;
You can’t perform that action at this time.
0 commit comments