Authentication
DefaultAuthProvider
import { DefaultAuthProvider } from 'adminjs';
import componentLoader from '<path to your component loader>';
// Placeholder authentication function, add your logic for authenticating users
const authenticate = ({ email, password }, ctx) => {
return { email };
}
const authProvider = new DefaultAuthProvider({
componentLoader,
authenticate,
});
// ...
// Express example, in other plugins the change is exactly the same
// "provider" should be configured at the same level as "authenticate" previously
const router = buildAuthenticatedRouter(
admin,
{
// "authenticate" was here
cookiePassword: 'test',
provider: authProvider,
},
null,
{
secret: 'test',
resave: false,
saveUninitialized: true,
}
);BaseAuthProvider
Last updated