Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
vercel-labs avatar

Oauth

  • 2.6k installs
  • 10.3k repo stars
  • Updated July 30, 2026
  • vercel-labs/portless

oauth is a portless skill for configuring OAuth providers to accept redirect URIs on portless local development domains.

About

The oauth skill from portless configures OAuth providers to work with portless local development URLs. Default .localhost subdomains fail provider validation because they are not on the Public Suffix List or are blocked, causing redirect_uri_mismatch errors. The fix uses portless proxy start --tld dev so apps serve on valid domains like https://myapp.dev, preferably under a subdomain you own such as myapp.local.yourcompany.dev with wildcard DNS to 127.0.0.1. Provider setup covers Google Cloud authorized origins and redirect URIs, Apple Services ID return URLs without localhost, Microsoft Entra web redirects, Facebook exact URI registration, and GitHub callback URLs. Auth library configuration sets NEXTAUTH_URL, AUTH_URL, BASE_URL, or PORTLESS_URL for callback construction. Troubleshooting addresses HTTPS requirements on HSTS-preloaded TLDs, Apple public DNS needs, and callbacks reverting to localhost. An example references Next.js plus NextAuth plus Google OAuth with --tld dev.

  • Explains why .localhost OAuth redirect URIs fail major providers.
  • Fixes redirects with portless --tld dev on valid Public Suffix List domains.
  • Documents Google, Apple, Microsoft, Facebook, and GitHub provider setup.
  • Covers NextAuth, Passport, and PORTLESS_URL callback configuration.
  • Troubleshoots redirect_uri_mismatch, HTTPS, and Apple domain rejection.

Oauth by the numbers

  • 2,563 all-time installs (skills.sh)
  • +91 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #213 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

oauth capabilities & compatibility

Capabilities
provider specific redirect uri registration guid · portless tld dev domain strategy · nextauth, passport, and portless_url configurati · https and hsts preloaded tld handling · troubleshooting callback and domain rejection is
Works with
vercel
Use cases
api development · frontend
Runs
Runs locally
Pricing
Free
From the docs

What oauth says it does

OAuth providers validate redirect URIs against domain rules.
SKILL.md
portless proxy start --tld dev
SKILL.md
NextAuth uses this to construct callback URLs.
SKILL.md
npx skills add https://github.com/vercel-labs/portless --skill oauth

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2.6k
repo stars10.3k
Security audit2 / 3 scanners passed
Last updatedJuly 30, 2026
Repositoryvercel-labs/portless

How do I fix OAuth redirect_uri_mismatch when using portless .localhost subdomains for local sign-in?

Configure OAuth redirect URIs for Google, Apple, Microsoft, Facebook, and GitHub to work with portless local dev domains.

Who is it for?

Local OAuth setup with portless, redirect URI mismatch fixes, and multi-provider dev callback configuration.

Skip if: Skip for production OAuth deployment, non-portless localhost-only setups that already work, or API key auth flows.

When should I use this skill?

User reports OAuth not working with portless, redirect URI mismatch, or Google or Apple sign-in failing locally.

What you get

Provider-registered redirect URIs and auth library env vars aligned to a valid portless dev domain.

  • OAuth redirect URI configuration
  • Provider-specific callback URL setup

By the numbers

  • Covers 5 named OAuth providers: Google, Apple, Microsoft, Facebook, and GitHub

Files

SKILL.mdMarkdownGitHub ↗

OAuth with Portless

OAuth providers validate redirect URIs against domain rules. .localhost subdomains fail on most providers because they are not in the Public Suffix List or are explicitly blocked. Portless fixes this with --tld to serve apps on real, valid domains.

The Problem

When portless uses the default .localhost TLD, OAuth providers reject redirect URIs like http://myapp.localhost:1355/callback:

Providerlocalhost.localhost subdomainsReason
GoogleAllowedRejectedNot in their bundled PSL
AppleRejectedRejectedNo localhost at all
MicrosoftAllowedAllowedPermissive localhost handling
FacebookAllowedVariesMust register each URI exactly
GitHubAllowedAllowedPermissive

Google and Apple are the strictest. Microsoft and GitHub are more lenient with localhost.

The Fix

Use a valid TLD so the redirect URI passes provider validation:

portless proxy start --tld dev
portless myapp next dev
# -> https://myapp.dev

Any TLD in the Public Suffix List works: .dev, .app, .com, .io, etc.

Use a domain you own

Bare TLDs like .dev mean myapp.dev could collide with a real domain. Use a subdomain of a domain you control:

portless proxy start --tld dev
portless myapp.local.yourcompany next dev
# -> https://myapp.local.yourcompany.dev

This ensures no outbound traffic reaches something you don't own. For teams, set a wildcard DNS record (*.local.yourcompany.dev -> 127.0.0.1) so every developer gets resolution without /etc/hosts.

Provider Setup

Google

1. Go to Google Cloud Console > Credentials 2. Create or edit an OAuth 2.0 Client ID (Web application) 3. Add the portless domain to Authorized JavaScript origins: https://myapp.dev 4. Add the callback to Authorized redirect URIs: https://myapp.dev/api/auth/callback/google

Google validates domains against the Public Suffix List. The domain must end with a recognized TLD. .localhost subdomains fail this check; .dev, .app, .com, etc. all pass.

HTTPS is required for .dev and .app (HSTS-preloaded). Portless handles this automatically with --https.

Apple

Apple Sign In does not allow localhost or IP addresses at all.

1. Go to Apple Developer > Certificates, Identifiers & Profiles 2. Register a Services ID 3. Configure Sign In with Apple, adding the portless domain as a Return URL: https://myapp.dev/api/auth/callback/apple

The domain must be a real, publicly-resolvable domain name. Since portless maps the domain to 127.0.0.1 locally, the browser resolves it but Apple's server-side validation may require the domain to resolve publicly too. If Apple rejects the domain, add a public DNS A record pointing to 127.0.0.1 for your dev subdomain.

Microsoft (Entra / Azure AD)

1. Go to Azure Portal > App registrations 2. Create or edit an app registration 3. Under Authentication, add a Web redirect URI: https://myapp.dev/api/auth/callback/azure-ad

Microsoft allows http://localhost with any port for development. It also accepts .localhost subdomains in most cases. Using a custom TLD with portless is still recommended for consistency across providers.

Facebook (Meta)

1. Go to Meta for Developers > App Dashboard 2. Under Facebook Login > Settings, add the portless URL to Valid OAuth Redirect URIs: https://myapp.dev/api/auth/callback/facebook

Facebook requires each redirect URI to be registered exactly (no wildcards). Strict Mode (enabled by default) enforces exact matching.

GitHub

1. Go to GitHub Developer Settings > OAuth Apps 2. Set Authorization callback URL: https://myapp.dev/api/auth/callback/github

GitHub is permissive with localhost and subdomains. A custom TLD is not strictly required but keeps the setup consistent.

Auth Library Configuration

NextAuth / Auth.js

Set NEXTAUTH_URL to match the portless domain:

NEXTAUTH_URL=https://myapp.dev

NextAuth uses this to construct callback URLs. Without it, callbacks may use localhost and cause a mismatch.

Passport.js

Set the callbackURL in each strategy to use the portless domain:

new GoogleStrategy({
  clientID: process.env.GOOGLE_CLIENT_ID,
  clientSecret: process.env.GOOGLE_CLIENT_SECRET,
  callbackURL: process.env.BASE_URL + "/auth/google/callback",
});

Set BASE_URL=https://myapp.dev in your environment.

Generic / Manual

Read the PORTLESS_URL environment variable that portless injects into the child process:

const baseUrl = process.env.PORTLESS_URL || "http://localhost:3000";
const callbackUrl = `${baseUrl}/auth/callback`;

Troubleshooting

"redirect_uri_mismatch" or "invalid redirect URI"

The redirect URI sent during the OAuth flow doesn't match what's registered with the provider. Check:

1. The provider's registered redirect URI matches the portless domain exactly (protocol, host, path) 2. NEXTAUTH_URL or equivalent is set to the portless URL (not localhost) 3. The proxy is running with the correct TLD (portless list to verify)

Provider requires HTTPS

.dev and .app TLDs are HSTS-preloaded, so browsers force HTTPS. Start the proxy:

portless proxy start --tld dev

Portless defaults to HTTPS on port 443 (auto-elevates with sudo). Run portless trust to add the local CA to your system trust store and eliminate browser warnings.

Apple rejects the domain

Apple may require the domain to resolve publicly. Add a DNS A record for your dev subdomain pointing to 127.0.0.1:

myapp.local.yourcompany.dev  A  127.0.0.1

Or use a wildcard: *.local.yourcompany.dev A 127.0.0.1.

Callback goes to wrong URL after sign-in

The auth library is constructing the callback URL from localhost instead of the portless domain. Set the appropriate environment variable:

  • NextAuth: NEXTAUTH_URL=https://myapp.dev
  • Auth.js v5: AUTH_URL=https://myapp.dev
  • Manual: PORTLESS_URL is injected automatically; use it as the base URL

Example

See `examples/google-oauth` for a complete working example with Next.js + NextAuth + Google OAuth using --tld dev.

Related skills

How it compares

Pick oauth over generic auth skills when the blocker is portless .localhost redirect URI rejection, not production OAuth architecture or session management.

FAQ

Why do .localhost subdomains fail OAuth?

Most providers reject them because they are not on the Public Suffix List or are explicitly blocked.

What TLD should portless use for OAuth?

Any valid PSL TLD like .dev or .app via portless proxy start --tld dev; prefer a subdomain you control.

How do I fix callbacks using localhost?

Set NEXTAUTH_URL, AUTH_URL, BASE_URL, or PORTLESS_URL to the portless domain, not localhost.

Is Oauth safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Backend & APIsintegrationsfrontend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.