@bastaai/ory-kratos-react-hooks
TypeScript icon, indicating that this package has built-in type declarations

0.0.0-alpha.0 • Public • Published

Ory Kratos React Hooks

Collection of convenient hooks for working with Ory Kratos, identity and user management system.

Hooks

  • useFlow: This hook allows you to easily manage authentication flows in your React applications.
  • useSession: Use this hook to access and manage user sessions with Ory Kratos.

Examples

useFlow

  • flowType: login | registration | recovery | settings | verification
  • render keys: input | a | img | text | script. Components are uncontrolled and submitted via form.
const { html, return_to } = useFlow({
  flowType: 'login',
  options: {
    render: {
      input: ({ meta, props }) => {
        if (props.type === 'submit') {
          return <Button {...props}>{meta.label?.text}</Button>;
        }

        return <input {...props} />;
      },
      a: () => {...},
      img: () => {...},
      text: () => {...},
      script: () => {...},
    },
  },
})

Readme

Keywords

none

Package Sidebar

Install

npm i @bastaai/ory-kratos-react-hooks

Weekly Downloads

0

Version

0.0.0-alpha.0

License

UNLICENSED

Unpacked Size

758 kB

Total Files

6

Last publish

Collaborators

  • sarabasta
  • einarlogi
  • viktorbasta