playwright-oauth-code-capture

Installation
SKILL.md

Playwright OAuth Code Capture

Problem

When automating OAuth flows with Playwright, the authorization code is passed via redirect to http://localhost?code=.... If no server is listening on localhost, the page shows "localhost refused to connect" and the authorization code in the URL is lost before you can extract it.

Context / Trigger Conditions

  • Automating Google OAuth, GitHub OAuth, or similar OAuth 2.0 flows
  • redirect_uri is set to http://localhost (common for desktop apps)
  • No local server running to receive the callback
  • Browser shows "This site can't be reached" or "localhost refused to connect"
  • Need to capture the authorization code from the redirect URL

Solution

Installs
1
First Seen
Apr 1, 2026