Skip to content

Commit 2d91a83

Browse files
authored
fix: suppress false-positive deprecation warning for cross_origin_auth when using cross_origin_authentication (#1322)
* fix: update sanitizeCrossOriginAuth to accept warning parameter * Refactor deprecation warning message format Update deprecation warning for 'cross_origin_auth' parameter.
1 parent f87fbbc commit 2d91a83

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

src/tools/auth0/handlers/clients.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,15 @@ export type Client = Management.Client;
345345

346346
type ClientSanitizerChain = {
347347
sanitizeOidcLogout(): ClientSanitizerChain;
348-
sanitizeCrossOriginAuth(): ClientSanitizerChain;
348+
sanitizeCrossOriginAuth(warn?: boolean): ClientSanitizerChain;
349349
get(): Client[];
350350
};
351351

352352
const createClientSanitizer = (clients: Client[]): ClientSanitizerChain => {
353353
let sanitized = clients;
354354

355355
return {
356-
sanitizeCrossOriginAuth() {
356+
sanitizeCrossOriginAuth(warn = true) {
357357
const deprecatedClients: string[] = [];
358358

359359
sanitized = sanitized.map((client) => {
@@ -373,12 +373,9 @@ const createClientSanitizer = (clients: Client[]): ClientSanitizerChain => {
373373
return updated;
374374
});
375375

376-
if (deprecatedClients.length > 0) {
376+
if (warn && deprecatedClients.length > 0) {
377377
log.warn(
378-
"The 'cross_origin_auth' parameter is deprecated in clients and scheduled for removal in future releases.\n" +
379-
`Use 'cross_origin_authentication' going forward. Clients using the deprecated setting: [${deprecatedClients.join(
380-
', '
381-
)}]`
378+
"The 'cross_origin_auth' parameter is deprecated. Use 'cross_origin_authentication' going forward."
382379
);
383380
}
384381

@@ -524,7 +521,7 @@ export default class ClientHandler extends DefaultAPIHandler {
524521
...(shouldExcludeThirdPartyClients(this.config) && { is_first_party: true }),
525522
});
526523

527-
this.existing = createClientSanitizer(clients).sanitizeCrossOriginAuth().get();
524+
this.existing = createClientSanitizer(clients).sanitizeCrossOriginAuth(false).get();
528525
return this.existing;
529526
}
530527

0 commit comments

Comments
 (0)