Developers and AI

What is OAuth?

Definition

OAuth is the standard behind "Sign in with..." and "Allow this app" screens. An app gets a limited token to act for you, you never hand it your password, and you can revoke the token later.

Also called: OAuth 2.0, Open Authorization, App authorization

How does OAuth work?

OAuth sends you to the service itself to approve an app, then gives the app a token instead of your password. The app never sees what you type, and the token only covers what you approved, known as its scope. A typical flow looks like this:

  • The app sends you to the service's own sign-in page.
  • You sign in there, see what the app is asking for and click Allow.
  • The service sends you back to the app with a one-time code.
  • The app swaps that code for an access token and sends the token with each request.

Is OAuth the same as logging in?

Not quite. OAuth is about giving an app access to your account; logging in is about proving who you are. The "Sign in with Google" kind of login uses OpenID Connect, a layer built on top of OAuth 2.0 that adds proof of identity.

In daily use the screens look alike, which is why people use the words loosely. The question to ask is what the app gets: only your name and email, or the right to read, upload or change things for you. The consent screen should say which.

Why use OAuth instead of an API key?

OAuth is better when someone else's app needs access, and an API key is simpler for your own code. With OAuth nobody pastes a secret into a config file, the app gets only the scope it asked for, and you can see and remove connected apps in one place. It is also how an AI assistant can connect to an MCP server without a key.

Tokens are short-lived, too. An access token often lasts about an hour, and a refresh token gets a new one in the background. A leaked token stops working soon on its own; a leaked key works until you delete it.

What should you check before you click Allow?

Check that you are on the real service and that the request makes sense. A fake app can use a genuine consent screen, so the page alone does not prove the app is safe. Look for these signs:

  • The address bar shows the service's own domain, over https.
  • The app name is the one you meant to connect.
  • The access it asks for fits what the app does. A note-taking app has no reason to send email for you.
  • You know where to disconnect it later, usually under connected apps in your account settings.
OAuth words in plain English
TermWhat it means
Access tokenThe pass an app sends with each request
Refresh tokenGets a new access token when the old one expires
ScopeWhat the token is allowed to do
Consent screenThe page where you click Allow
PKCEA check that stops a stolen one-time code from being used

OAuth: common questions

Does OAuth share my password with the app?

No. You type your password only on the service's own page, and the app receives a token. That is the main point of OAuth.

How do I revoke OAuth access?

Open the service's settings and look for connected apps, authorized apps or a similar list, then remove the app. Its tokens stop working, and it has to ask you again to get back in.

What is the difference between OAuth 1.0 and OAuth 2.0?

OAuth 2.0 replaced 1.0 and is the version services use today. It is simpler for apps to build, relies on HTTPS for transport security and has flows for phones, browsers and servers.

Why does an app ask me to sign in again?

Its refresh token expired or was revoked, or you disconnected the app. Signing in again gives it a new token; your password does not change.

Go deeper

Updated

Share a file as a link in seconds

Upload any file and get one clean link, with every setting on this page.

Try Link in Seconds

Optional cookies for analytics, ads and session replay.