ExploreMy JigsMission
MakeMake a Jig

© JigSpace Inc. 2026

jig.comContact@JigSpace on X

OAuth Anatomy

publicRemix · Free
NBy Numa

How OAuth lets an app use your photos on another site with a temporary valet key, without ever seeing your password. Follows the four roles, the authorization code swap and PKCE.

Transcript

9 steps · 2 min read
  1. 1

    Step 1: OAuth, taken apart

    When an app asks to use your photos or calendar on another site, OAuth is the trick that lets it in without ever learning your password. Think of a valet key: it can drive the car, but it cannot open the trunk.

    OAuth started in 2006 with engineers at Twitter and friends. Today's version, OAuth 2.0, is an internet standard called RFC 6749.

  2. 2

    Step 2: Four roles

    You own the stuff. The app (the client) wants to use some of it. The authorization server checks who you are and hands out keys. The resource server keeps your stuff locked up and only opens for a valid key.

One company can run both servers, but they are still separate jobs.

  • 3

    Step 3: The app asks

    The app cannot just walk in. It sends you, through your browser, to the authorization server with a request card. The card says who is asking and what it wants: its scope, such as read your photos.

    The card also carries a random word called state, so the app can spot fake replies.

  • 4

    Step 4: Only you say yes

    You log in at the authorization server itself, so your password key goes only there, never to the app. Then you see exactly what the app wants and choose to allow it or not.

  • 5

    Step 5: A claim ticket

    The server does not hand over a key yet. It sends a claim ticket, called an authorization code, back through your browser to the app. The ticket works only once and only for a short time.

    The rules recommend a code lives at most 10 minutes.

  • 6

    Step 6: The back-room swap

    Now the app goes to the authorization server directly, along the back channel, server to server. It trades the ticket for an access token, the valet key. It may also get a refresh token for later.

    The browser never carries the token, so it is harder to snoop on.

  • 7

    Step 7: Using the valet key

    The app shows the access token to the resource server, and the vault opens just enough to share your photos. The token only allows what you agreed to, and whoever holds it gets in, so it must be kept secret.

    A token often expires after minutes to an hour; the standard's own example uses 3,600 seconds.

  • 8

    Step 8: A secret handshake

    What if a copycat grabs the claim ticket on its way? With PKCE, the app made up a secret at the start and sent only its scrambled fingerprint. At the swap the app must show the secret itself, so a stolen ticket is useless.

    PKCE (say it pixie) uses a secret 43 to 128 characters long.

  • 9

    Step 9: Keys that run out

    Access tokens expire on purpose, so a lost one stops working soon. The app can quietly trade its refresh token for a fresh key, and you can take access back at any time. That is OAuth: limited, temporary, and your password stays yours.

    Refresh tokens only ever go to the authorization server, never to the vault.