What is OAuth?
Behind every "Sign in with Google" button is OAuth: a way to hand an app a limited valet key instead of your real password. The flow in five steps, and why redirect URLs break it.

Key takeaways
- OAuth is a standard for granting an app limited access to an account on another service without sharing the password.
- Social sign-in uses OAuth plus OpenID Connect: the provider confirms identity and returns tokens to your app.
- Most setup failures are a redirect URL that does not exactly match what is registered with the provider.
OAuth is an open standard that lets one app get limited access to your account on another service (Google, GitHub, Apple, Spotify) without ever learning your password. The version in use today is OAuth 2.0. Every "Sign in with Google" or "Connect your calendar" button you have clicked runs on it.
An everyday example: the valet key
Some cars come with a valet key. It starts the engine and opens the door, but it cannot open the trunk or the glovebox. You hand it to the parking attendant instead of your full key ring. OAuth works the same way: instead of giving a scheduling app your Google password, you approve a screen that says "This app wants to see your calendar events," and Google hands the app a token that can do exactly that and nothing else. You can take the key back later from your Google account settings without changing your password.
The flow in five steps
- 01The user taps Sign in with Google in your app.
- 02Your app redirects them to Google with your client ID, the permissions it wants (called scopes, such as email and profile) and a redirect URL to come back to.
- 03The user signs in at Google, on Google's page, and approves.
- 04Google sends the user back to your redirect URL with a short-lived code.
- 05Your backend exchanges that code, together with your client secret, for tokens. Your app now knows who the user is.
The password is only ever typed into Google. Your app receives tokens with an expiry and a limited scope. When the purpose is signing in rather than reading someone's files, a thin layer on top called OpenID Connect adds an ID token that says who the user is, usually as a JWT.
Why it matters when building with Startbase
In Startbase Cloud, Google sign-in is a toggle in the Auth section's sign-in settings: you paste the client ID and secret you created in Google's developer console. Apple sign-in takes a Services ID and a secret JWT. Saved provider secrets are never displayed again. The same screen has a URLs panel where you set your Site URL and the redirect URLs allowed after sign-in (auth docs). That panel matters more than people expect, because of the error below.
Add "Continue with Google" next to email sign-in on the login screen. After sign-in, send new users to a short profile setup page and returning users to their dashboard. Tell me exactly which redirect URLs to add in Google's console and in the Auth URLs panel for both the preview and my published address.
For the wider picture of sign-in methods, read user authentication explained. Your client secret is a secret like any other: see API keys and secrets.
Setup errors you will probably meet
- redirect_uri_mismatch. The redirect URL your app sent does not match one registered with the provider, character for character. `https://` versus `http://`, `www` versus no `www` and a trailing slash all count. Register both your preview and live addresses.
- Works in testing, fails for everyone else. Google keeps new OAuth apps in a testing mode limited to listed test users until you publish the consent screen.
- Sign-in loops back to the login page. Usually the Site URL still points at an old address, so the session lands on the wrong domain.
Common confusions
- OAuth is not a login system on its own. It was built for delegated access; sign-in identity comes from OpenID Connect on top.
- The client secret is not the user's password. It identifies your app to the provider and must stay on the server.
- Scopes should be minimal. Asking for full Drive access when you only need an email address scares users off the consent screen.
Frequently asked questions
Is OAuth safer than email and password?
For your app, often yes: you never store a password, and the provider handles two-factor checks and suspicious sign-ins. The trade-off is depending on that provider being available.
Do I need a privacy policy for Google sign-in?
Google asks for a privacy policy link and app details on the consent screen before your app can leave testing mode, so plan to have one.

