Auth
Authentication (user accounts) is enabled by running the vela enable auth command. This
will prompt for configuration options. The auth module creates all necessary code for authentication,
including login, logout, sign up, password reset, email verification and more.
Syntax
$ vela enable auth Protected routes
Once enabled, a group of protected routes is automatically created, defaulting to (app). Any routes placed within this group will be protected and require authentication to access.
Unauthenticated users will be redirected to the login page. The protected routes and the login
path for redirection can be configured in the middleware in hooks.server.ts, defaults
shown below:
import { handlePocketbase } from '@vela/pocketbase';
export const handle = handlePocketbase({
auth: {
enabled: true,
protectedRoutes: ['/(app)'],
loginPath: '/login'
}
}) OAuth
OAuth is supported out of the box with PocketBase. Configure the OAuth providers in the PocketBase admin interface. Any enabled OAuth provider will be available in the authentication flow.
Subsequent scaffolds
Once auth is enabled, subsequent scaffolded routes will automatically be created within the
protected (app) group.