@@ -5,7 +5,7 @@ import * as pulumi from '@pulumi/pulumi';
55import { KubeConfig , CoreV1Api } from '@kubernetes/client-node' ;
66import { getSecretVersionOutput } from '@pulumi/gcp/secretmanager' ;
77import { Output } from '@pulumi/pulumi' ;
8- import { AuthenticationClient , ManagementClient , TokenResponse } from 'auth0' ;
8+ import { AuthenticationClient , ManagementClient , TokenSet } from 'auth0' ;
99
1010import type {
1111 Auth0Client ,
@@ -66,7 +66,7 @@ export class Auth0Fetch implements Auth0Client {
6666 domain : this . cfg . auth0Domain ,
6767 clientId : this . cfg . auth0MgtClientId ,
6868 clientSecret : this . cfg . auth0MgtClientSecret ,
69- scope : 'read:clients read:client_keys' ,
69+ // scope: 'read:clients read:client_keys',
7070 retry : {
7171 enabled : true ,
7272 maxRetries : 10 ,
@@ -77,15 +77,16 @@ export class Auth0Fetch implements Auth0Client {
7777 let page = 0 ;
7878 /* eslint-disable no-constant-condition */
7979 while ( true ) {
80- const clients = await client . getClients ( {
80+ const clients = await client . clients . getAll ( {
8181 per_page : 50 , // Even though 50 is the default, if it's not given explicitly, the page argument is ignored
8282 page : page ++ ,
8383 } ) ;
84- if ( clients . length === 0 ) {
84+
85+ if ( clients . data . length === 0 ) {
8586 return secrets ;
8687 }
8788
88- for ( const client of clients ) {
89+ for ( const client of clients . data ) {
8990 if ( client . client_id && client . client_secret ) {
9091 secrets . set ( client . client_id , client as Auth0ClientSecret ) ;
9192 }
@@ -211,11 +212,11 @@ export class Auth0Fetch implements Auth0Client {
211212 clientSecret : clientSecret ,
212213 } ) ;
213214
214- const tokenResponse = await auth0 . clientCredentialsGrant ( {
215+ const tokenResponse = await auth0 . oauth . clientCredentialsGrant ( {
215216 audience : aud ,
216217 } ) ;
217218
218- const { expires_in } = tokenResponse ;
219+ const { expires_in } = tokenResponse . data ;
219220
220221 if ( expires_in < REQUIRED_TOKEN_LIFETIME ) {
221222 /* If you see this error, you either need to decrease the required token
@@ -230,12 +231,12 @@ export class Auth0Fetch implements Auth0Client {
230231
231232 const expiry = addTimeSeconds ( now , expires_in ) ;
232233
233- await this . cacheNewToken ( clientId , expiry , tokenResponse ) ;
234+ await this . cacheNewToken ( clientId , expiry , tokenResponse . data ) ;
234235
235- return tokenResponse . access_token ;
236+ return tokenResponse . data . access_token ;
236237 }
237238
238- private async cacheNewToken ( clientId : string , expiry : Date , tokenResponse : TokenResponse ) {
239+ private async cacheNewToken ( clientId : string , expiry : Date , tokenResponse : TokenSet ) {
239240 await pulumi . log . debug (
240241 'Caching access token for Auth0 client: ' + clientId + ' expiry: ' + expiry . toJSON ( )
241242 ) ;
0 commit comments