Skip to main content

Fiber v3 + goauth overview

goauth is framework-agnostic (net/http). For Fiber v3 use the companion module fiberauth — same idea as @auth/express in Auth.js.

flowchart LR
subgraph Fiber app
R[Routes /api/*]
M[fiberauth middleware]
H[fiberauth.Handler]
end
subgraph goauth core
A[goauth.Auth]
end
Client --> H
H --> A
R --> M
M --> A

What fiberauth provides

APIPurpose
fiberauth.Handler(auth)Mount all /auth/* actions (sign-in, callback, session, token, MFA, …)
fiberauth.GetSessionLoad session + forward Set-Cookie
fiberauth.SessionFromRead session stored by middleware
fiberauth.ProtectRequire login (401)
fiberauth.GuardLogin + custom rules (roles, claims)
fiberauth.HasRole / HasClaim / ConditionBuilt-in authorizers

Typical app layout

/auth/* → fiberauth.Handler(auth) # all goauth actions
/api/public → no auth
/api/me → fiberauth.Protect(auth)
/api/admin/* → fiberauth.Guard(auth, HasRole("admin"))
/login → your SPA or redirect to Pages.SignIn

Docs in this section

PageTopic
Installationgo get + minimal main.go
Mounting & auth APIRoutes exposed through Fiber
MiddlewareProtect, Guard, SessionLoader, JSON errors
Sessions, user & rolesSessionFrom, JWT callback, claims
Sign in (credentials)Email/password, bearer tokens
OTP & passwordlessEmail code login (like “magic code”)
Forgot / reset passwordMagic link or OTP reset flow
MFA & trusted devicesTwo-step login + deviceId
Redirects & pagesLogin redirect, errors, SPA
Full example appComplete Fiber server

Official Fiber docs: Welcome · fiberauth repo: github.com/izetmolla/fiberauth