API template library

Simulate the Facebook Login API

A WireMock simulation of Facebook's REST API — covering the login dialog, access-token exchange, and the Graph profile endpoint.

Vendor
Facebook
Functionality
OAuth login and profile
Spec version
22.0
Endpoints
4
Stubs
5
Protocol
REST
Validation
AI-validated Before publication, an AI agent exercised these endpoints against the real Facebook API through WireMock's recording proxy, and the recorded traffic was used to verify each stub's request and response shapes.

Live sandbox · no signup, no API key

Facebook Sign-in Mock

A running WireMock Cloud instance of this template, callable right now from a terminal, a script, or an AI agent.

Base URL
https://vkv97.wiremockapi.cloud

POST Exchange an authorization code for an access token

curl -s -X POST 'https://vkv97.wiremockapi.cloud/oauth/access_token' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=authorization_code&code=demo&client_id=demo-client'

GET Get the user profile with the access token from the sample above

curl -s -X GET 'https://vkv97.wiremockapi.cloud/me?fields=id,name,email&access_token=EAAbW9ja3VzZXJAZXhhbXBsZS5jb218fE1vY2t8fFVzZXI%3D'

GET Login dialog (authorize endpoint)

curl -s -X GET 'https://vkv97.wiremockapi.cloud/dialog/oauth'
Method Path Summary
GET /dialog/oauth Authorization Endpoint
GET /me Get Current User
GET /oauth/access_token Access Token Endpoint (GET)
POST /oauth/access_token Access Token Endpoint

Unauthenticated WireMock Cloud demo sandbox for Facebook — not an official Facebook sandbox, and it returns simulated example data only.

What's inside the Facebook template

The mechanism worth knowing about: identity travels inside the token. The exchange endpoint mints an EAA-prefixed string — Facebook's token format — with the mock user's profile encoded in it, and /me decodes that string back into Graph fields: numeric id, name split into first and last, email, and a picture object down to the is_silhouette flag. The round trip means the profile your code reads is provably the one the login issued.

  • Login dialog — /dialog/oauth serving a clickable Facebook-styled sign-in screen
  • Token exchange — the access_token endpoint trading an authorization code for a long-lived bearer token
  • Graph profile — /me unpacking the token into the standard user-node fields
  • Form handler — the login POST that 302s back to your app with code and state intact

Facebook Login mock API FAQ

Either place the Graph API accepts it: the access_token query parameter or an Authorization: Bearer header. Both resolve the same profile, so SDKs that default to the header work against the sandbox unchanged.

The same OAuthException envelope Graph uses, with HTTP 400. A value that isn't an EAA token gets code 190, "Invalid OAuth access token - Cannot parse access token", and no token at all gets code 2500. Only strings minted by the exchange carry an encoded profile, so thread its output through to see your own user rather than the default Mock User.

expires_in comes back at roughly sixty days, matching Facebook's long-lived user tokens rather than the two-hour short-lived kind. Expiry bookkeeping — storing the deadline, scheduling a refresh — gets a realistic number to chew on, though the mock itself never actually expires anything.

POST. Facebook's docs describe fetching the token with a GET, and the template's spec lists that variant, but the live stub matches the POST form only. Beyond that, coverage stops at login: feed, friends, and the rest of the Graph belong in a private copy where you define the nodes your app touches.

Vendor names identify APIs represented by WireMock template sources. This page does not imply vendor endorsement, certification, partnership, or official integration status.