@hanabira/auth
TypeScript icon, indicating that this package has built-in type declarations

0.9.0 • Public • Published

Hana Auth

Hana auth is a lightweight authentication service for React-based applications. It gives you these features out of the box:

  • Simple authentication flow
  • Lightweight and easy to use
  • Strongly typed with Typescript

Example

import { useLogin, GuestState } from '@hanabira/auth';

const MyPage = () => {
  const login = useLogin();

  return (
    <GuestState>
      <button
        onClick={() => {
          login({
            token: 'some-token',
            user: { name: 'John Doe' },
          });
        }}
      >
        Login
      </button>
    </GuestState>
  );
}

export default MyPage;
import { withGuestState } from '@hanabira/auth';

const MyPage = ({ login }) => {
  return (
    <button
      onClick={() => {
        login({
          token: 'some-token',
          user: { name: 'John Doe' },
        });
      }}
    >
      Login
    </button>
  );
}

export default withGuestState(MyPage);

Installation

npm i @hanabira/auth # npm users
yarn add @hanabira/auth # yarn users
pnpm i @hanabira/auth # pnpm users

Readme

Keywords

none

Package Sidebar

Install

npm i @hanabira/auth

Weekly Downloads

16

Version

0.9.0

License

MIT

Unpacked Size

46.2 kB

Total Files

5

Last publish

Collaborators

  • mychi