OAuth

Fix OAuth Errors on Okta

Last updated: April 2026

Common Okta OAuth errors and the admin console settings to address them.

Diagnose OAuth errors live โ†’

redirect_uri_mismatch

Okta Admin โ†’ Applications โ†’ Your App โ†’ General โ†’ Sign-in redirect URIs. Add the exact URI.

https://yourapp.com/callback
http://localhost:3000/callback

Enable PKCE

# Okta Admin -> Applications -> Your App -> General Settings
# Proof Key for Code Exchange (PKCE): require PKCE

# OktaAuth SDK config:
const oktaAuth = new OktaAuth({
  issuer: 'https://YOUR_DOMAIN/oauth2/default',
  clientId: 'YOUR_CLIENT_ID',
  redirectUri: window.location.origin + '/callback',
  pkce: true,
});

invalid_grant

Okta authorization codes expire after 5 minutes. Check: Admin โ†’ Security โ†’ API โ†’ Authorization Servers โ†’ Your server โ†’ Access Policies for token lifetimes.

CORS error calling Okta endpoints

Okta Admin โ†’ Security โ†’ API โ†’ Trusted Origins โ†’ Add your frontend origin with CORS enabled.

https://yourapp.com     # add with CORS type
http://localhost:3000   # add for development