Let a custom id be provided for a new access token #4707
gregmsanderson
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Something we would like to not expose for now. The goal is to keep things simple and avoid many moving parts. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I see that currently you can provide a
name
andexpiresIn
for a new access token. I think it would be useful to also (optionally) let people provideid
(which could then be a cuid or nanoid, for example).I'm trying to keep all resource IDs consistent and since access tokens have no model, I see that the token's
id
is currently being determined from the auto-incremented primary key returned after the insert. It looks like that ID is then used as part of the generated token, base64-encoded.Essentially it would need an extra, optional id:
... in https://github.com/adonisjs/auth/blob/main/modules/access_tokens_guard/token_providers/db.ts along with some other small changes within that function to check for and use that id.
It doesn't seem worth generating a whole custom provider just to add that.
Beta Was this translation helpful? Give feedback.
All reactions