adonisjs / auth

Official Authentication package for AdonisJS
https://docs.adonisjs.com/guides/auth/introduction
MIT License
193 stars 65 forks source link

Feature Request: Centralized Configuration for Default Token Expiration Duration #223

Closed Kledenai closed 7 months ago

Kledenai commented 1 year ago

Why this feature is required (specific use-cases will be appreciated)?

I've been working with Adonis Auth and realized that there isn't a straightforward way to set a default token expiration duration. In many scenarios, applications have a standard token expiration time, for instance, a day. Currently, to set token expiration, we have to specify it in the controller rather than in a configuration file. Having a configuration-based approach could streamline and standardize this process across multiple parts of an application. It would be much more efficient and developer-friendly to have a centralized config setting for token expiration.

Have you tried any other workarounds?

Yes, I've been setting the token expiration manually in the controller for each token generation. While this works, it's not optimal for scenarios where a uniform token duration is required across the application.

Are you willing to work on it with little guidance?

While I have some ideas on how this feature could be integrated and made configurable, I'm constrained by time. I might be able to contribute, but I would need to gain a deeper understanding of Adonis' current architecture and the best practices you follow for new feature implementations. This would ensure that any contribution from my end aligns well with your standards and process.

stale[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

RomainLanz commented 7 months ago

Hey @Kledenai! 👋🏻

We changed how it was done in AdonisJS 6. I believe it matches your request.