Skip to content

Commit 293f4bd

Browse files
Merge pull request #78 from andreacavagna01/master
Fixed aws sso service for showing multiple accounts
2 parents 2ccbd9e + 608c647 commit 293f4bd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/app/integrations/providers/aws-sso.service.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,16 @@ export class AwsSsoService extends NativeService {
263263

264264
listAccounts(accessToken: string, region: string): Observable<any> {
265265
this.ssoPortal = new SSO({ region });
266-
267-
const listAccountsRequest: ListAccountsRequest = { accessToken };
268-
266+
const listAccountsRequest: ListAccountsRequest = { accessToken, maxResults: 10 };
269267
return fromPromise(this.ssoPortal.listAccounts(listAccountsRequest).promise()).pipe(
270268
expand((response: ListAccountsResponse) => {
271-
return (response.nextToken !== null ? fromPromise(this.ssoPortal.listAccounts(listAccountsRequest).promise()) : EMPTY);
269+
if (response.nextToken !== null) {
270+
// Add the token to the params
271+
listAccountsRequest['nextToken'] = response.nextToken;
272+
return fromPromise(this.ssoPortal.listAccounts(listAccountsRequest).promise());
273+
} else {
274+
return EMPTY;
275+
}
272276
}),
273277
take(300), // safety block for now
274278
toArray(),

0 commit comments

Comments
 (0)