Different number of tokens - UI/API vs DB
Hi,
I am using /backend/app/token endpoint for some admin stuff and I noted that it doesn't return some tokens that are present in fusio_app_token table. Indeed, there is much more tokens in this table then returned by API or found in UI (both filtered by my app_id and user_id and having active status)
I suppose there must be a reason for that but can't figure it out.
Thx for any info.
regards, dejan
Hi Dejan, so there is a a max limit on the count of token which are included in the response, maybe you hit this limit and older tokens are therefor hidden, the default limit is 16.
Hi.
No, I set count to 1000 in API request. For example, this: "/backend/app/token?appId=3&userId=3&status=1&count=1000" returns 148 tokens while this: "select count(*) from fusio_app_token where user_id=3 and status=1 and app_id=3" returns 669 tokens. So I am obviously missing something
Hey, ok so the /backend/app/token endpoint normally also expects a from and to param which indicates the start and end date, if you dont specify a specific date Fusio uses by default the last month, so this is probably the reason why only 148 tokens are returned. You may also take a look at our test case s.
https://github.com/apioo/fusio-impl/blob/master/tests/Backend/Api/App/Token/CollectionTest.php#L57
Hi,
Ok I didn’t know fo “last month”. But still, I can’t get all the tokens from database using API. For example:
"select max(date) from fusio_app_token where user_id=3 and status=1 and app_id=3” gives 2022-05-01 14:46:04, and
"select min(date) from fusio_app_token where user_id=3 and status=1 and app_id=3” gives 2021-05-01 07:29:51
If I put that in API request, like:
/backend/app/token?appId=3&userId=3&status=1&from=2021-05-01 07:29:51&to= 2022-05-01 14:46:04
I get 127 as totalResults. Should I use some other dates? I tried with earlier “from” but it doesn’t help.
regards, dejan
On 01 05 2022, at 21:49, Christoph Kappestein @.***> wrote:
Hey, ok so the /backend/app/token endpoint normally also expects a from and to param which indicates the start and end date, if you dont specify a specific date Fusio uses by default the last month, so this is probably the reason why only 148 tokens are returned. You may also take a look at our test case s. https://github.com/apioo/fusio-impl/blob/master/tests/Backend/Api/App/Token/CollectionTest.php#L57 https://github.com/apioo/fusio-impl/blob/master/tests/Backend/Api/App/Token/CollectionTest.php#L57 — Reply to this email directly, view it on GitHub https://github.com/apioo/fusio/issues/452#issuecomment-1114319996, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFIABWKYTFWRBUZ7FGRT6LVH3N5HANCNFSM5URVCNHA. You are receiving this because you authored the thread.
Can you check the url with the correct date format for the from and to param it should be in ISO 8601 i.e. 2022-05-02T00:00:00 and no leading or trailing space
I did and I also tried this:
/backend/app/token?appId=3&userId=3&status=1&from=2021-05-01&to=2022-05-02. I still get 127 records, while
select count(*) from fusio_app_token where user_id=3 and status=1 and app_id=3 gives 679
On 02 05 2022, at 19:28, Christoph Kappestein @.***> wrote:
Can you check the url with the correct date format for the from and to param it should be in ISO 8601 i.e. 2022-05-02T00:00:00 and no leading or trailing space
— Reply to this email directly, view it on GitHub https://github.com/apioo/fusio/issues/452#issuecomment-1115151501, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFIABVCGR5Z25BYWF2ELE3VIAGDBANCNFSM5URVCNHA. You are receiving this because you authored the thread.
Ok, so Iam not really sure how we can solve this since I can not reproduce the problem but feel free to create a PR at the test case s. https://github.com/apioo/fusio-impl/blob/master/tests/Backend/Api/App/Token/CollectionTest.php
which covers your case, then we can also create a fix for this.