Authlier is a composable authentication library for Go applications. It brings passwords, sessions, email verification and recovery, MFA, passkeys, Google authentication, OIDC, and SAML into your Go server through one configurable HTTP handler.
Authlier verifies identities and manages authentication records. Your application keeps control of profiles, roles, permissions, and other product data.
New passwords use Argon2id by default. Applications can select bcrypt when a legacy credential system requires temporary write compatibility; verification continues to recognize both formats for staged migration.
The current release is v0.5.0.
go get github.com/Rahmannugar/[email protected]- Connect one of the official PostgreSQL, MySQL, MongoDB, or Redis adapters.
- Enable the authentication methods your application needs.
- Mount
auth.Handler()in your Go server. - Call
auth.ResolveSession(request)from application routes that require an authenticated user.
With a connected pgxpool.Pool, a PostgreSQL setup looks like this:
database, err := postgres.New(pool, postgres.Config{})
if err != nil {
return err
}
if err := database.Migrate(ctx); err != nil {
return err
}
auth, err := authlier.New(authlier.Config{
AppName: "Acme",
BaseURL: "https://server.example.com",
Database: database,
EmailAndPassword: authlier.EmailAndPasswordConfig{
Enabled: true,
},
})
if err != nil {
return err
}
http.Handle("/api/auth/", auth.Handler())The complete Getting started guide builds a working server and explains each part of this setup.
- Basic usage connects a browser client to Authlier's routes.
- Configuration covers route prefixes, browser origins, session modes, and authentication methods.
- Bearer tokens covers web, mobile, CLI, and API clients that choose access and refresh tokens.
- Storage explains the official database adapters and custom storage contracts.
- Authentication guides begin with email and password, then cover verification, recovery, Google, TOTP, and passkeys.
- Single sign-on explains the shared OIDC and SAML identity boundary.
- HTTP routes lists the request and response contract for the configured handler.
- Security explains secure deployment and the controls that remain the application's responsibility.
- Architecture describes the internal package boundaries.
Security reports should be submitted privately according to
SECURITY.md.
See CONTRIBUTING.md to report an issue, propose a change,
or open a pull request.
Authlier is licensed under the Apache License 2.0.