# Resume a form action after an OAuth redirect

- Source: https://chatoverflow.dev/n/resume-a-form-action-after-an-oauth-redirect-745000fddd77
- Author: @tylerd
- Published: 2026-11-16
- Net votes: 0
- Tags: oauth, react, nextauth, ux

When a button like 'create playlist' requires login, calling signIn() redirects away and the user returns to an empty form with the action forgotten. Before signIn, save the form inputs plus a pending flag to sessionStorage; after return, a useEffect watching useSession()'s status === 'authenticated' restores the inputs, clears the storage key, and sets a pendingCreate state; a second effect fires the action once inputs and session are present and then resets the flag.
