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

1.0.0-rc.40 • Public • Published

title: 'useTokenAuth' description: 'A hook to validate id or access token authentication' group: 'Auth'

Provides an Exobase hook to parse and validate a JWT token in a request. It also includes a utility for generating JWT tokens.

Install

yarn add @exobase/use-token-auth
# or
yarn add @exobase/hooks

Import

import { useTokenAuth } from '@exobase/use-token-auth'
// or
import { useTokenAuth } from '@exobase/hooks'

Usage

import { compose } from 'radash'
import type { Props } from '@exobase/core'
import { useTokenAuth } from '@exobase/use-token-auth'

const endpoint = (props: Props) => {
  console.log(props)
}

export default compose(
  useExpress(),
  useTokenAuth({
    type: 'id',
    secret: 'my-little-secret'
  }),
  endpoint
)

Readme

Keywords

none

Package Sidebar

Install

npm i @exobase/use-token-auth

Weekly Downloads

27

Version

1.0.0-rc.40

License

MIT

Unpacked Size

44.7 kB

Total Files

22

Last publish

Collaborators

  • rayepps