HeyMark
Content

Blog

What is OAuth, and how does it work when you connect an app or an MCP server to your account?

11 min read

OAuth is a standard that lets an app get limited access to your account on another service, with your approval and without you handing over your password. You sign in to the service, review the permissions the app is asking for and approve them. The service then gives the app an access token: a credential that only works for what you approved, and only for a while. The current version is OAuth 2.0, published as RFC 6749 in October 2012; OAuth 2.1 is an IETF draft that consolidates it.

We read every source on this page on December 1, 2026.

An example: an app asks for permission to post to your account

Fictional example. You use Plano, a post scheduling app, and you want it to publish to your account on a social network. Every name, address and value below is made up.

1. Plano sends you to the social network. You tap “Connect” and your browser opens a page on the network, not on Plano. The address carries what Plano is asking for, roughly like this:

https://network.example/authorize?response_type=code
  &client_id=plano-app
  &redirect_uri=https%3A%2F%2Fplano.example%2Fcallback
  &scope=profile.read%20posts.create
  &state=x7Kq2
  &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
  &code_challenge_method=S256

scope lists the permissions: here, reading your profile and creating posts. Each service defines its own names; as the OAuth 2.1 draft puts it, “OAuth does not define any scope values”; the authorization server defines them.

2. You sign in to the network and see the consent screen. You type your password on the network, not on Plano. The network shows you which app is asking for access and for what, and you approve or deny. Per section 4.1 of RFC 6749, at this step the authorization server authenticates you and “establishes whether the resource owner grants or denies” the request.

3. The network sends Plano a code. If you approve, the browser returns to plano.example/callback with a one-time code. RFC 6749 recommends that this code last 10 minutes at most.

4. Plano trades the code for tokens. Plano sends the code to the network, server to server, and gets back a response in the format from section 5.1 of RFC 6749:

{
  "access_token": "a1B2c3D4e5F6",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "r9S8t7U6v5W4",
  "scope": "profile.read posts.create"
}

5. Plano posts with the access token. Every time it posts, it attaches the access_token to the request. The network validates it and, if it covers posts.create, accepts the post. expires_in says it expires in 3,600 seconds (one hour).

6. When it expires, Plano uses the refresh token. With the refresh_token it requests a new access token without bothering you again.

7. One day you stop using Plano and revoke its access from the network’s settings. Once the network invalidates the tokens, Plano can no longer post, even if it still has them stored.

Plano never saw your password, it can only do what the scope says, and you can cut off its access without changing your password. That’s what OAuth is for.

What OAuth is, in the standard’s own words

RFC 6749 defines OAuth 2.0 as an authorization framework that enables a third-party application “to obtain limited access to an HTTP service”, on behalf of the resource owner and with their approval. Its introduction describes the problem it solves: before, for an app to use your account, you gave it your username and password, and the app had to store them. The RFC’s own example is a printing service that needs your photos stored on another site.

The standard splits the work across four roles:

Role What it is In the example
Resource owner Whoever can grant access You
Client The app requesting access on your behalf Plano
Authorization server Authenticates you and issues the tokens The network’s sign-in page
Resource server Holds what’s protected and accepts the tokens The network’s API that receives the post

Per the same RFC, the authorization server may be the same server as the resource server or a separate one. What matters is the split: the app never gets your password, it gets a token.

What is an OAuth token?

A token is a string that represents a permission. OAuth uses two:

  • The access token is the credential the app uses to act on your account. RFC 6749 says it represents “specific scopes and durations of access, granted by the resource owner.” The OAuth 2.1 draft adds why they’re short-lived: “to limit the impact of a leaked access token.”
  • The refresh token is used to get new access tokens when the current one expires. RFC 6749 says it’s meant for use only with the authorization server and, unlike access tokens, is never sent to resource servers. It doesn’t always exist: the authorization server decides whether to issue one.

The permission you approved doesn’t grow with each refresh. Section 6 of RFC 6749 says that when refreshing, the requested scope must not include anything the resource owner didn’t originally grant; it can be the same or narrower. Some servers also rotate the refresh token: they issue a new one with every refresh, and the app must discard the old one. And the server can give the app less than it asked for: if that happens, RFC 6749 requires it to tell the app which scope it actually granted.

OAuth authorizes, but it doesn’t identify you: OpenID Connect

OAuth answers “what can this app do with your account?” It doesn’t answer “who are you?” The OpenID Connect Core 1.0 specification says so in its introduction: OAuth 2.0 does not define standard methods to provide identity information. OpenID Connect describes itself as “a simple identity layer on top of the OAuth 2.0 protocol.”

In practice, when an app lets you sign in with your account from another service and needs to know who you are, the standard for that is OpenID Connect. The app includes the openid scope in its request and receives, in addition to the access token, an ID Token: a token containing claims about how the server authenticated you. Without openid, the request isn’t an OpenID Connect request.

OAuth 2.0 OpenID Connect
Question it answers What the app can do with your account Who you are and how you authenticated
What the app receives An access token (sometimes a refresh token too) The same, plus an ID Token
How it’s requested Whatever scopes the service defines The openid scope, plus any others it needs

What is OAuth 2.1?

OAuth 2.1 is an IETF draft, not a published RFC. On the IETF datatracker, the latest version is 17, from October 2026, with the status of a working group document, and it’s meant to replace RFC 6749 and RFC 6750 once approved. It doesn’t invent a new protocol: it combines OAuth 2.0 with the best practices published since and drops what came to be considered unsafe. Its section 1.8 sums it up: “features not specified in OAuth 2.0 core, such as PKCE, are required in OAuth 2.1.”

Topic OAuth 2.0 (RFC 6749) OAuth 2.1 (draft)
PKCE A separate extension (RFC 7636) Required in the authorization code flow
Redirect URI Registering only part of it was allowed Exact string match
Implicit flow (token straight to the browser) Included Removed
Password flow (the app asks for your username and password) Included Removed
Access token in the URL RFC 6750 allowed it, while discouraging it Not allowed
Refresh tokens for public apps Rotation was optional Bound to the app that received them, or single use

PKCE is what shows up as code_challenge in the example. RFC 7636, from 2015, created it to stop authorization code interception. The app makes up a secret, sends the network only its fingerprint (with S256, the SHA-256 hash of the secret) and, when trading the code for tokens, reveals the full secret. The MCP specification explains it this way: PKCE ensures that only the original requester can exchange an authorization code for tokens. If someone intercepts the code from step 3, it’s useless to them.

The draft warns that apps that don’t use PKCE, that rely on pattern matching for redirect URIs, or that use the implicit or password flows won’t work with servers that enforce OAuth 2.1. The standard’s community site, oauth.net, describes OAuth 2.1 as an in-progress effort to consolidate and simplify the most commonly used features of OAuth 2.0.

OAuth in MCP: what happens when you connect a server to your assistant

MCP is the protocol an AI assistant, like Claude or ChatGPT, uses to work with tools from other services; what it is and how it fits together is in what is MCP. Its authorization specification (current version, 2026-07-28) says that authorization is OPTIONAL for MCP implementations. When it’s used, implementations over HTTP should follow it; those using the STDIO transport (servers that run on your computer) should not, and get their credentials from the environment instead.

The specification is based on the OAuth 2.1 draft and uses the same roles as the example: the MCP server is the resource server, your assistant is the client, and an authorization server deals with you and issues the tokens. It also requires the client to use PKCE, and recommends that the authorization server issue short-lived access tokens. If the MCP server in turn calls another API, the specification forbids it from passing along the token it got from your assistant: for that other API it uses a separate token, issued by that API’s authorization server. In Claude, a remote server is added as a connector; how that works and where to disconnect it is in what are Claude connectors.

HeyMark’s MCP server uses OAuth 2.1, with no keys to generate. It works in any MCP client that supports OAuth: you sign in with your own HeyMark account, so your assistant sees what you see and nothing else. MCP access is free on every plan, though actions keep their plan limits and AI credit costs; the URL and how to connect it are on HeyMark’s MCP page. If you’re deciding between coding against an API and connecting an MCP server, the comparison is in social media API or MCP: which one you need.

Before you approve permissions, and how to revoke them

The consent screen has the information that matters. Check:

  1. Where you’re typing your password. With OAuth you sign in to the service that holds your account, not to the app asking for access. If the app asks for your network password in its own form, that isn’t the flow described here: OAuth 2.0 included a password flow, and OAuth 2.1 removed it.
  2. Which app is asking. The name on the screen should be the app you’re connecting.
  3. What permissions it asks for, and whether they match what you want. Reading your profile and posting on your behalf carry different risks. An analytics app asking for permission to post is asking for too much.
  4. Which account you’re signed in with. If you manage several brands, make sure the open session belongs to the right brand before you approve.

To revoke, go to the connected apps settings of the service that holds your account (not the app’s). RFC 7009 defines how an app tells the server it no longer needs a token, for example when you log out or uninstall it, and says revoking can also invalidate the other tokens from the same authorization. One caveat: if the server doesn’t support revoking access tokens, one that was already issued keeps working until it expires.

On Facebook, revoking doesn't erase what the app already stored

Facebook’s help article on third-party apps says that “removing the app, website or game only prevents it from continuing to access your non-public information through Facebook,” and that “the app, website or game may have stored information from when you were using it.” An app’s access to non-public information expires after 90 days of inactivity, except for business integrations (apps with permissions to monitor or manage Pages, groups, ads and messages), whose permissions don’t expire from inactivity.

Plan your next post in HeyMark.

Keep the idea, review the draft with your team, and see how it performed in the accounts you connected.