Adonis auth scaffold offers you painless authentication built on top Persona.js available within seconds.
Spend those minutes you'd use in setting up authentication doing awesome stuff within your app.
app
└── Controllers
└── HTTP
├── AuthController.js
├── ApiAuthController.js
config
├── adonis-auth-scaffold.js
public
└── auth
├── auth-styles.css
resources
└── views
└── auth
└── emails
├── password.edge
├── welcome-mail.edge
└── partials
├── password-change-form.edge
├── password-reset-request-form.edge
└── layouts
├── auth.edge
├── dashboard.edge
├── login.edge
├── password-reset.edge
├── register.edge
start
├── authEvents.js
├── authRoutes.js
├── apiAuthRoutes.js
Adonis Auth Scaffold is a CLI utility that gives you a functional authentication system in Adonis.js within seconds.
Install adonis-auth-scaffold by running the below command.
NPM
npm install adonis-auth-scaffold --save-dev
npm install @adonisjs/mail @adonisjs/persona @adonisjs/validatorYarn
yarn add adonis-auth-scaffold --save-dev
yarn add @adonisjs/mail @adonisjs/persona @adonisjs/validatorThe adonis-auth-scaffold provider must be registered as an aceProvider.
We are running CLI commands after all!
const aceProviders = [
'adonis-auth-scaffold/providers/AdonisAuthScaffoldProvider'
];Also add providers for the newly installed dependencies.
const providers = [
"@adonisjs/validator/providers/ValidatorProvider",
"@adonisjs/mail/providers/MailProvider",
"@adonisjs/persona/providers/PersonaProvider"
]Register the below middleware in start/kernel.js
const globalMiddleware = [
"App/Middleware/ViewHelper"
]Please run the below command to scaffold authentication.
adonis make:authA prompt to choose between generating code for a RESTful Api or a HTTP client allows you customize the generated files for your specific use case.
Alternative versions of this command involves passing either the --api-only or --http-only flags.
To generate auth files for a REST Api, you may run:
adonis make:auth --api-onlyPlease add the following line at the beginning of start/events.js.
require('./authEvents');Run the following command to run startup migrations.
Please remember to add the status column to your User migration.
adonis migration:runContributions are welcome! Check out the issues or the PRs, and make your own if you want something that you don't see there.

