Redirect Flow
Full-page OAuth Verify: navigate to hosted UI, return to your callback with code + state, resume PKCE exchange, then validate on your server.
On this page
When to use redirect
- Paste script:
mode: "redirect"(or letautochoose when popup is unsuitable). - Web SDK:
verifyWithRedirect()thenhandleRedirectCallback()on the callback route.
Exact redirect URI
http://localhost:3000/callback≠http://localhost:3000/callback/- http vs https must match the registered value
- Register both local and production URIs in the Developer Portal
Paste script
KeyraOAuth.renderButton("#keyra-login", {
authOrigin: "https://auth.keyra.ie",
clientId: "cp_test_YOUR_PUBLISHABLE_ID",
redirectUri: "http://localhost:3000/auth/keyra/callback",
mode: "redirect",
autoCompleteRedirect: true, // default true
onSuccess: async function (result) { /* POST token to backend */ },
onError: function (err) { console.error(err); },
});With autoCompleteRedirect: true (default), the script detects callback query params and finishes the exchange. You can also call KeyraOAuth.completeRedirectCallback(opts) explicitly on the callback page.
Web SDK
await keyra.verifyWithRedirect();
// navigates to KEYRA hosted UIconst result = await keyra.handleRedirectCallback();
// then POST result.verificationToken to your backendMissing or mismatched state → callback_state_missing / invalid_state (KeyraOAuthError).
PKCE storage keys
| Surface | Key | Storage |
|---|---|---|
| Paste script | keyra:oauth:flow:v2 | Session storage for PKCE across redirect |
| Web SDK | keyra_sdk_transient | sessionStorage transient PKCE/state |
After callback
Next: Server validation.
