Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

stormpathApplication.getAccounts() #619

Open
peebles opened this issue Jul 1, 2017 · 2 comments
Open

stormpathApplication.getAccounts() #619

peebles opened this issue Jul 1, 2017 · 2 comments

Comments

@peebles
Copy link

peebles commented Jul 1, 2017

I am using 4.0.0-rc4 and migrating a Stormpath app.

I am trying to find an account by email. My code

    var spapp    = app.get('stormpathApplication');
    spapp.getAccounts( { email: email }, function( err, collection ) {
      if ( err ) return cb( err );
      var accounts = [];
      collection.each( function( account, cb ) {
	accounts.push( account );
	cb();
      }, function( err ) {
	if ( err ) return cb( err );
       console.log( accounts );
    });

I have about 1000 accounts. The first problem is that getAccounts() is returning more than one account. The second problem is that it is returning only 50 accounts.

It seems like (1) the query is being ignored and (2) the collection iterator is not paging ... the default page size appears to be 50, and I only get the first page.

Am I doing something incorrectly?

@peebles
Copy link
Author

peebles commented Jul 1, 2017

Passing in { limt: 50, offset: 100 } is also ignored. Limit seems to be honored, but no matter what offset is, I always get the first page.

@robertjd
Copy link
Member

robertjd commented Jul 5, 2017

Hi @peebles , that method comes from the underlying Node SDK, which is not being 100% patched for Okta.

I would suggest trying the alpha version of our Okta Node SDK:

https://github.com/okta/okta-sdk-nodejs#list-all-org-users

Please note that this module is not yet on NPM, you you will need to use the Git URL in your package.json

The Okta pagination API is different, but does support limit parameter, which can be passed to client.listUsers({limit: 100})

https://developer.okta.com/docs/api/getting_started/design_principles.html#pagination

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants