> ## Documentation Index
> Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Stytch Password Reset

> Implement password reset UI using the Stytch React SDK

<Frame>
  <img src="https://mintcdn.com/stytch-34ca0595/chUftqYqk2C1W0Ql/images/api-reference/b2c/frontend-sdks/prebuilt-ui-password-reset.png?fit=max&auto=format&n=chUftqYqk2C1W0Ql&q=85&s=6b3806c91e9fc8dfcf5aecb5830a70c6" alt="Example of Password Reset component" style={{ maxWidth: "400px" }} width="864" height="786" data-path="images/api-reference/b2c/frontend-sdks/prebuilt-ui-password-reset.png" />
</Frame>

The SDK comes with a pre-built UI component to reset passwords for our Passwords product. Render this component on the page at `resetPasswordRedirectURL` if using our `<StytchLogin>` prebuilt component, or the URL sent to the user by our [reset password start API](/api-reference/consumer/api/passwords/reset-options/password-reset-by-email-start).

## Props

<ParamField path="passwordResetToken" type="string">
  Password reset token. The component will read the token from the current page by default, you only need to pass this in if the token is not there. To retrieve the token manually, use the `client.parseAuthenticateUrl()` method. The token will be available in the `token` property in the returned object.
</ParamField>

<ParamField path="config" type="object">
  The configuration object for the UI component. This component accepts the same `config` as StytchLogin so you can reuse the config, although most options will not have any effect.

  <Expandable title="properties">
    <ParamField path="sessionOptions" type="object">
      The options for session management. We create a session for users when they log in. You can access a user or session using the User or Session SDK methods.

      <Expandable title="properties" defaultOpen>
        <ParamField path="sessionDurationMinutes" type="number">
          Set the session lifetime to be this many minutes from now; minimum of 5 and a maximum of 527040 minutes (366 days). Note that a successful authentication will continue to extend the session this many minutes.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField path="presentation">
  The `presentation` field allows you to customize the look of the SDK. This component accepts the same `presentation` prop as `StytchLogin` so you can reuse it. For more information, see the [Theming documentation](./theming).
</ParamField>

<ParamField path="callbacks" type="object">
  Optional callbacks that are triggered by various events in the SDK. See more details about the callbacks [here](/api-reference/consumer/frontend-sdks/react/prebuilt-ui/login/callbacks).

  <ParamField path="onEvent" type="(data) => void">
    A callback function that responds to events sent from the SDK.

    <Expandable title="events" defaultOpen>
      <ParamField path="PASSWORD_RESET_BY_EMAIL" type="(data) => void">
        Fired when the user successfully reset their password.

        ```ts data theme={null}
        {
          user_id: "user_id",
          session: { ... },
          user: { ... },
          user_device?: { ... }
        }
        ```
      </ParamField>
    </Expandable>
  </ParamField>

  <ParamField path="onError" type="(data) => void">
    A callback function that responds to errors in the SDK. It is useful for debugging during development and error handling in production.
  </ParamField>
</ParamField>

<ParamField path="strings" type="object">
  Specify custom strings to be used in the prebuilt UI. Consult the message catalog (messages/en.po) for the list of available strings. Each value should be specified using ICU MessageFormat.

  Strings that are not defined will use the default English value as a fallback.

  See [Text Customization](/api-reference/consumer/frontend-sdks/react/prebuilt-ui/text-customization) for more information.
</ParamField>

<Panel>
  <CodeGroup>
    ```jsx theme={null}
    import { StytchPasswordReset, useStytch } from '@stytch/react';

    const config = {
      sessionOptions: {
        sessionDurationMinutes: 60,
      },
    };

    export const ResetPassword = () => {
      const stytch = useStytch();
      const parsed = stytch.parseAuthenticateUrl();

      if (!parsed?.token) {
        // Handle missing token
        return <>...</>;
      }

      return <StytchPasswordReset config={config} passwordResetToken={parsed.token} />;
    };
    ```
  </CodeGroup>
</Panel>
