I can't read extra fields (e.g., logged_database, logged_company) from the auth_access_tokens table in middleware (Adonis V6) #4872
ivansansao
started this conversation in
General
Replies: 1 comment
-
Yeah, I think it will be nice to include a meta property on the token that contains all these additional fields as a JSON blob and then you can access them via the token, Feel free to send a PR for the same 👍 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am unable to retrieve extra fields (e.g., logged_database, logged_company) from the auth_access_tokens table inside middleware when using Adonis V6.
In the example below, I cannot access these extra fields:
As a result, I am forced to make an additional database query to retrieve these extra fields from auth_access_tokens.
Even if I could retrieve these extra fields, I wouldn't be able to pass them to the controllers efficiently.
Now, consider an API running on the cloud with 1,000 users accessing 100 different routes—each making two database queries instead of one. This would be very costly in terms of performance.
My Suggestions:
1 - Optionally include extra fields in the meta property.
2 - Provide a way to pass these fields to the controller, maybe ctx.meta.
I discussed this issue on Discord, and we came to the conclusion that there is currently no solution for this.
Beta Was this translation helpful? Give feedback.
All reactions