Login not working in your app: how to fix it
Most broken logins come down to one of five things: redirect URLs, unconfirmed emails, provider settings, a session that never gets saved, or a paused backend.

Key takeaways
- If login works in preview but not on your live address, the Site URL and allowed redirect URLs are the first suspect.
- If email sign-in "does nothing", the account is usually waiting for a confirmation email that went to spam or was never sent.
- Google and Apple sign-in fail when the client ID, secret or callback URL in the provider console does not match your backend exactly.
When login fails in an app you built, the most likely cause is a redirect URL mismatch: the sign-in itself succeeds, but the backend refuses to send the user back to an address it was not told about, so they land on an error or back at the login screen. That is especially likely if login works in the preview and breaks on your published or custom domain. The next most common cause is an email account that was never confirmed.
Start by writing down exactly what happens, because each symptom points somewhere different: an error message, a redirect loop, an email that never arrives, or a login that seems to work and then forgets you on refresh.
Match your symptom first
- "Invalid login credentials" with the right password: the account is unconfirmed, banned, or was created with a different sign-in method (for example, Google, then later a password attempt).
- Sent back to the login page after Google or a magic link: redirect URL not allowed, or the session is not being stored.
- "Redirect URL not allowed" or a provider error page: callback or redirect configuration.
- No confirmation or magic-link email: email delivery, spam folder or daily sending limits.
- Logged in, then logged out on refresh: the app is not reading the stored session on load.
- Worked yesterday, fails for everyone today: the backend is paused or disabled.
The causes, most likely first
1. Site URL and redirect URLs
Magic links, password resets and Google or Apple sign-in all end with the backend sending the user to a URL. For safety, it only sends them to addresses on an allow list. If you published to `yourapp.startbase.app`, then added a custom domain, but the allow list still only has the preview address, every sign-in on the new domain fails.
How to check: in Startbase Cloud, open the Backend tab, go to the Users section, then Sign-in settings. The URLs panel holds your Site URL and the redirect URLs allowed after sign-in. Compare them, character by character, with the address in your browser bar, including `https://` and `www`. The fix: set the Site URL to your main live address and add every address people sign in from: the startbase.app address, the custom domain, and the `www` version if you use both.
2. The account is not confirmed
Email and password sign-in usually requires the user to click a confirmation link before the first login. Until then, logins fail, often with a vague "invalid credentials" error that sends people resetting passwords for no reason.
How to check: the Users tab lists each account with a status: Confirmed, Invited, Pending or Banned. A Pending user has not clicked the link. The fix: for one stuck user, ask them to check spam, or have the agent send a fresh confirmation. When you add a user yourself from the Users tab, the "mark email as confirmed" toggle skips the step. For everyone, make sure confirmation emails are actually delivered (cause 4), and show a clear "check your inbox" screen after sign-up instead of dropping the user back on the login form.
3. Google or Apple provider settings
Social sign-in has two sides that must agree. In your backend you paste the Google client ID and secret (or Apple's Services ID and secret JWT). In Google Cloud Console or Apple's developer site, you must list your backend's sign-in callback URL as an authorized redirect. A typo, a trailing slash, or a secret pasted from the wrong project breaks it.
How to check: the Overview section of the Backend tab shows your sign-in callback with a copy button. Copy it and compare it with the authorized redirect URIs in the provider console. If Google shows "redirect_uri_mismatch", this is the cause. The fix: paste the exact callback into the provider console, and re-save the client ID and secret in Sign-in settings. Saved secrets are never shown again, and leaving the field empty keeps the stored value, so paste the new one if you rotated it. Apple's secret JWT also expires (Apple caps it at six months), so a working Apple login can break on a date.
4. Emails that never arrive
Magic links and confirmations depend on email. The built-in sender works for testing but has tight volume limits and lands in spam more often than a branded domain. How to check: look in spam, then check the Logs section filtered to Auth for send errors or rate limits. The fix: connect your own sending domain in the Emails section and choose "Use this domain for auth emails". If you edited the templates, make sure placeholders like `{{ .ConfirmationURL }}` are still intact; removing them breaks the link. Our guide to why app emails go to spam covers the DNS side.
5. The session is not kept
If users sign in fine but appear logged out after a refresh or on the next page, the app is probably checking for a user before the stored session has loaded, or it creates a fresh backend client on every page. How to check: sign in, refresh, and see whether the app briefly shows a logged-in state and then flips, or never shows it. The fix: the app should create one client, wait for the initial session check before deciding to show the login page, and listen for auth state changes. This is a code fix the agent can make in one turn.
6. The backend is paused or disabled
If sign-in stopped working for everyone at once, check the backend before the code. Disabling Cloud for a project stops sign-in, data and uploads until you enable it again. On Hosted by Startbase, hosted databases pause if the Cloud Credits balance runs out. How to check: the Overview section shows whether the backend is running, paused or waking. The fix: re-enable Cloud or add funds; nothing is deleted in either case.
7. Invite-only mode or a ban
If new people cannot sign up but existing users can sign in, check whether Invite only is on in Sign-in settings; it blocks new signups entirely. A single user who cannot get in may show as Banned in the Users tab.
Test login like a stranger would
You are always logged in as yourself, which hides most of these bugs. After any fix, test in a private window, on the live address, with a fresh email address you have never used. Run through sign-up, confirmation, sign-out, sign-in, password reset and refresh. Then do it once on a phone. The whole pass takes ten minutes and catches nearly every problem above.
The message to send the agent
The agent can read your auth logs, check the code that handles sessions, and fix it. Give it the symptom, the address and the exact error:
Login is broken on the published site (https://www.example.com). In the preview it works. With Google sign-in, users come back to the login page with no error; with email they see "Invalid login credentials". Please: check the auth logs for the last hour, confirm the Site URL and redirect URLs include both the startbase.app address and www.example.com, check whether new users are stuck as unconfirmed, and make sure the app waits for the stored session before redirecting to /login. Tell me anything I need to change in Google Cloud Console myself, with the exact callback URL.
For background on how the pieces fit together, read user authentication explained and the glossary entry on OAuth. The full list of sign-in options is in the Auth docs.
Frequently asked questions
Why does login work in preview but not on my custom domain?
Almost always because the custom domain is missing from the allowed redirect URLs, or the Site URL still points at the old address. Add the exact domain, with https and www if you use it.
Why do I get "invalid login credentials" with the right password?
Usually the account has not been confirmed yet, or it was created with Google or a magic link and has no password. Check the user's status and sign-in methods in the Users tab.
My Apple sign-in suddenly stopped working. Why?
Apple's client secret is a signed token with an expiry date, at most six months out. When it expires, sign-in fails. Generate a new one and save it in Sign-in settings.
Can I let users in without email confirmation?
You can add users with their email marked as confirmed, and anonymous sign-in lets people try the app before creating an account. Skipping confirmation for everyone invites fake and mistyped accounts, so weigh that before turning it off.

