2.5.1 • Published 9 months ago

@hanzo/auth v2.5.1

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
9 months ago

Hanzo Auth

Initialization

Follow these steps to initialize authentication with Hanzo Auth for your project:

  1. Install package with pnpm i @hanzo/auth

  2. Create custom Header component that includes an AuthWidget from @hanzo/auth. See example in luxdefi/sites repo

  3. Edit root layout component

// ... other imports

import { AuthServiceProvider } from '@hanzo/auth/service'
import { getUserServerSide } from '@hanzo/auth/server'
import type { AuthServiceConf } from '@hanzo/auth/types'

// custom header with AuthWidget
import Header from '@/components/header'

// ...other code

const RootLayout: React.FC<PropsWithChildren> = async ({
  children
}) =>  {
  const currentUser = await getUserServerSide()

  return (
    <AuthServiceProvider user={currentUser} conf={{} as AuthServiceConf}>
      <RootLayoutCommon siteDef={siteDef} header={false} >
        <Header siteDef={siteDef}/>
        {children}
      </RootLayoutCommon>
    </AuthServiceProvider>
  )
}
export default RootLayout
  1. Create /api/auth/login route.
import { NextRequest } from 'next/server'

import { handleLoginApiRequest } from '@hanzo/auth/server'

export async function POST(request: NextRequest) {
  return handleLoginApiRequest(request)
}
  1. Create /api/auth/logout route.
import { handleLogoutApiRequest } from '@hanzo/auth/server'

export async function GET() {
  return handleLogoutApiRequest()
}
  1. Create /login route that uses LoginComponent from @hanzo/auth. See example in luxdefi/sites repo
2.5.0

9 months ago

2.5.1

9 months ago

2.4.20

9 months ago

2.4.18

12 months ago

2.4.17

1 year ago

2.4.19

12 months ago

2.4.14

1 year ago

2.4.13

1 year ago

2.4.16

1 year ago

2.4.15

1 year ago

2.4.10

1 year ago

2.4.12

1 year ago

2.4.11

1 year ago

2.4.7

1 year ago

2.4.9

1 year ago

2.4.8

1 year ago

2.4.5

1 year ago

2.4.6

1 year ago

2.4.1

1 year ago

2.4.0

1 year ago

2.4.3

1 year ago

2.4.2

1 year ago

2.4.4

1 year ago

2.3.6

1 year ago

2.3.5

1 year ago

2.3.4

1 year ago

2.3.3

1 year ago

2.3.2

1 year ago

2.3.1

1 year ago

2.3.0

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.1.0

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.10

1 year ago

2.0.0

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago