Skip to content

bastaai/ory-kratos-react-hooks

Repository files navigation

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: () => {...},
    },
  },
})

About

Convenient React hooks for Ory Kratos

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors