Review the simple password-only sign-in use case from the sample app.
Set up the Okta configuration settings
Review the src/config.js file that references the required app integration settings to initialize your Okta Auth JS instance. The config.js file references the values that you add to the .env file.
Note: Okta Auth JS 8.x requires every idx.proceed() call to name the remediation step it's submitting. This guide uses that Step Mode pattern throughout. See Step Mode vs Legacy Mode (opens new window) in the Auth JS SDK docs if you're migrating an older app that relies on the deprecated, generic remediation-driven pattern.
Instantiate the Okta Auth JS client
Review the React app.js file that imports the required libraries and instantiates the Okta Auth JS client with values from the config.js. Wrap your app in the Security component from the Okta React SDK so it can manage the Auth JS instance for you.
Note: This guide's simplified example doesn't cover redirect callbacks (for example, social IdP sign-in or email magic links). If your app needs them, see Redirect callbacks (opens new window) in the Auth JS SDK docs and the LoginCallback component in Okta's reference sample app (opens new window).
Start the sign-in transaction
Before you can render a sign-in form, you need an in-progress IDX transaction to drive it. Start one when your component mounts by calling idx.start(). idx.start() begins the transaction. It doesn't resolve a step's field data until you name that step. Call idx.proceed() with only a step name and no other values. The SDK then returns that step's inputs for rendering. For this password-only use case, the sign-in flow always begins with the identify step, which asks for username:
Pass transaction.nextStep into formTransformer to render the form fields for the current step. See Basic sign-in flow for the full form code. Okta's Identity Engine collects the username first. It then challenges for the password on a separate step. This password-only flow therefore renders two forms in sequence, not one combined form.
Handle the password authentication
Name the step you're submitting on every idx.proceed() call. transaction.nextStep.name holds that name. It matches the step the form already rendered. Submitting a step's values reveals the name of the next step. It does not reveal that step's renderable field data. Call idx.proceed() again with just the step name to prime the next form before you render it. Review the app.js file for details on handling a successful password authentication. It receives the SUCCESS status and stores the returned tokens:
For this password-only use case, handleSubmit runs twice. The first run submits username from the identify step and primes the challenge-authenticator step. The second run submits password from that step and reaches IdxStatus.SUCCESS.
The full sign-in component code
With the pieces above in place, here's the complete App.jsx for the password-only sign-in flow, with everything shown together: