AdonisJS v7 Documentation Update: Introducing @adonisjs/sesame OAuth 2.1 Server and OAuth/OpenID Connect Features
· Developer impact : high
The AdonisJS v7 documentation introduces the new package @adonisjs/sesame, which enables turning an AdonisJS application into a full OAuth 2.1 authorization server supporting authorization code flow with mandatory PKCE, refresh token rotation, token introspection and revocation, client credentials, dynamic client registration, and OpenID Connect (OIDC). It integrates with existing user accounts and login/consent pages, adding OAuth endpoints and an oauth auth guard for access token verification. The documentation provides detailed guidance on installation, configuration, OAuth flows, client management, token formats (opaque and JWT), resource indicators, key rotation, security best practices, and testing. It also covers advanced features like multi-tenant grant context, client metadata validation, discovery endpoints, and maintenance commands for purging revoked tokens and unused clients.
Developers gain a comprehensive OAuth 2.1 and OpenID Connect server implementation within AdonisJS, allowing them to secure APIs and manage OAuth clients and tokens natively. They must integrate the sesame package, configure guards and middleware, implement login and consent pages, and adapt their auth configuration to include the oauth guard. The documentation clarifies complex OAuth concepts, token management, and security considerations, enabling developers to implement robust and standards-compliant authorization servers. Testing and maintenance workflows are improved with new commands and API methods. Developers should review the new configuration options, understand token formats and scopes, and follow security best practices outlined in the docs.
- Install @adonisjs/sesame package and its dependencies (AdonisJS 7, Node.js 24+, @adonisjs/auth with session guard)
- Run the sesame add command to register providers, middleware, config, and migrations
- Configure sesame in config/sesame.ts including issuer URL, store, scopes, default scopes, login and consent URLs
- Implement login and consent pages to handle user authentication and authorization consent
- Add the oauth guard and oauthUserProvider to config/auth.ts alongside session guard
- Protect API routes using the oauth guard and scopes middleware
- Use sesame CLI commands to create OAuth clients and manage keys
- Enable OpenID Connect and JWT access tokens if needed by configuring sesame accordingly
- Implement custom OAuthUserProviderContract if using external user sources
- Review and apply security best practices such as CSRF exemptions, short token TTLs, and key rotation procedures as documented
Updated documentation
Original sources
AI-generated analysis based on the linked sources. Check the original documentation before changing your application.