Authentication
Wayfare uses Better Auth. Which login methods appear is decided by environment variables (reference). Owners and guests use the same methods.
For every OAuth provider register this redirect (callback) URI:
${WAYFARE_BASE_URL}/api/auth/callback/<provider>with <provider> = google, apple, facebook or discord. Example: https://photos.example.com/api/auth/callback/google. The URL must exactly match WAYFARE_BASE_URL.
Admin bootstrap
- Everyone whose e-mail is in
WAYFARE_ADMIN_EMAILS(comma-separated) becomes admin — but only with a verified address (social login, magic link or a confirmed e-mail/password account). Registering such an address without verifying it grants nothing. - Only if
WAYFARE_ADMIN_EMAILSis empty, the very first account of an empty instance becomes admin (a warning is logged). Recommendation: always setWAYFARE_ADMIN_EMAILSbefore the instance is reachable. - Afterwards admins promote other users in /admin → Users and choose the onboarding mode.
E-mail and password
Set AUTH_EMAIL_PASSWORD=true. Off by default because most people prefer magic links or social login.
Magic link
On by default (AUTH_MAGIC_LINK=true). Requires working mail (Mail); without SMTP_URL the link is only printed to the server log — fine for development.
Passkeys
AUTH_PASSKEY=true (default). Passkeys require HTTPS (except on localhost) and a stable domain — a passkey is bound to the domain name, so changing WAYFARE_BASE_URL invalidates existing passkeys. Do not use passkeys on a throw-away URL.
Google
- Google Cloud Console → create/select a project.
- APIs & Services → OAuth consent screen: choose External, set app name, support e-mail and your domain; scopes
openid,email,profileare non-sensitive. - Credentials → Create credentials → OAuth client ID → Web application.
- Authorized redirect URI:
${WAYFARE_BASE_URL}/api/auth/callback/google. - Set
AUTH_GOOGLE_IDandAUTH_GOOGLE_SECRET.
Publish the consent screen (In production) so that not only test users can log in. You can reuse the same client for photo import by adding the second redirect URI.
Apple
Sign in with Apple needs an Apple Developer Program membership (99 USD/year) and an HTTPS domain.
- Certificates, Identifiers & Profiles → Identifiers: create an App ID with the Sign in with Apple capability.
- Create a Services ID (e.g.
com.example.wayfare.web). Enable Sign in with Apple and Configure: primary App ID, your domain (withouthttps://) and the return URL${WAYFARE_BASE_URL}/api/auth/callback/apple. - Keys: create a key with Sign in with Apple, download the
.p8file once and note the Key ID and your Team ID. - Apple's "client secret" is a JWT signed with that key (ES256;
iss=Team ID,sub=Services ID,aud=https://appleid.apple.com, lifetime max. 6 months). Generate it with a small script or the Better Auth docs' helper. - Set
AUTH_APPLE_ID= Services ID andAUTH_APPLE_SECRET= the JWT.AUTH_APPLE_BUNDLE_IDis only needed for native apps.
The secret expires
Regenerate the JWT before it expires (at the latest every 6 months) and restart. Put a reminder in your calendar.
Facebook
- developers.facebook.com → Create app (use case: Authenticate and request data from users with Facebook Login).
- Add the Facebook Login product → Valid OAuth Redirect URIs:
${WAYFARE_BASE_URL}/api/auth/callback/facebook. - Settings → Basic: copy App ID and App Secret →
AUTH_FACEBOOK_ID,AUTH_FACEBOOK_SECRET. Set privacy-policy URL (your /privacy page) and an app icon. - The app starts in development mode: only app roles (you, testers) can log in. To open it to everybody switch to Live — Meta may require a business verification and app review for permissions beyond
emailandpublic_profile. Wayfare only needs these two basic permissions, which are available without review once the app is live.
Discord
- discord.com/developers/applications → New Application.
- OAuth2: add the redirect
${WAYFARE_BASE_URL}/api/auth/callback/discord; copy the Client ID and Client Secret. - Set
AUTH_DISCORD_IDandAUTH_DISCORD_SECRET. Scopesidentifyandemailare used.
Check it
Restart Wayfare and open the login page — each configured provider shows a button. If something fails, check Troubleshooting.