API template library

GitHub OAuth sign-in mock API and live sandbox

A WireMock simulation of GitHub's REST API — covering the authorization page, code-for-token exchange, and the user profile and email endpoints.

Vendor
GitHub
Functionality
OAuth login, tokens, emails
Spec version
1.0.0
Endpoints
4
Stubs
6
Protocol
REST
Validation
AI-validated Before publication, an AI agent exercised these endpoints against the real GitHub 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

GitHub 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://rqz1l.wiremockapi.cloud

POST Exchange an authorization code for an access token

curl -s -X POST 'https://rqz1l.wiremockapi.cloud/login/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 authenticated user -- swap YOUR_ACCESS_TOKEN for the access_token from the sample above

curl -s -X GET 'https://rqz1l.wiremockapi.cloud/user' \
  -H 'Authorization: Bearer gho_YOUR_ACCESS_TOKEN'
Method Path Summary
POST /login/oauth/access_token Access Token Endpoint
GET /login/oauth/authorize Authorization Endpoint
GET /user Get Authenticated User
GET /user/emails Get User Emails

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

What's inside the sign-in template

Four routes distill the complete "Sign in with GitHub" journey: an authorization page a browser can actually click through, the form-encoded exchange that answers with a gho_-prefixed token — GitHub's OAuth token format, scope string read:user,user:email attached — and the two API calls a login integration makes next. /user returns the whole account object, from login and avatar down to follower counts and timestamps, while /user/emails supplies the verified primary address apps fall back to when the profile hides one.

  • Authorization page — a GitHub-styled sign-in screen at the standard /login/oauth/authorize path
  • Token exchange — the access_token POST answering in GitHub's gho_ format with scopes attached
  • User profile — /user rebuilding the signed-in account object from the presented token
  • Email addresses — /user/emails listing a verified primary address with visibility flags

Frequently asked questions

They divide the work. The GitHub REST v3 template mocks the platform — repos, issues, Actions, the lot — while this one isolates the login handshake, small enough to hold in your head while debugging an OAuth callback. Pair them if a feature both signs users in and calls the API afterwards.

Skip the developer-settings ritual entirely: no callback URL allowlisting, no client secret to store. The authorize route accepts any client_id, and the exchange completes with placeholder values — the parts of GitHub app setup that usually block a first login test simply have no equivalent here.

The account object is reconstructed from data packed inside the gho_ token, so the profile endpoint only understands tokens the exchange produced. Feed it an invented string and the decode step errors out instead of returning 401 — wire the two calls in sequence, as a real integration would.

The exchange always reports read:user,user:email — the canonical pair a sign-in-only integration requests. Code that parses the scope string to decide what it's allowed to fetch sees a stable, minimal grant; broader grants like repo access are yours to script in a WireMock Cloud copy.

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