0.5.1 • Published 2 years ago

rook-provider v0.5.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

RookMotion Auth

RookMotion Auth contains a Provider to notify the submodules if the apps is authorized by the given token

Instalation

npm

npm i rook-provider

yarn

yarn add rook-provider

Usage

The package include a component call RookMotionProvider, it should preferably be used at the root of your component tree. RookMotionProvider needs the token that was given to you.

import { RookMotionProvider } from 'rook-provider'

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
  <React.StrictMode>
    <RookMotionProvider token='YOUR-TOKEN'>
      <App />
    </RookMotionProvider>
  </React.StrictMode>
)

Then to verify if the apps was allowed you need to use the hook useRookAuth, this give you two flags:

  • ready: indicate if the package is fully loaded
  • authenticated: indicate if the app was allowed.
import { useRookAuth } from 'rook-provider'

const myComponent = () => {
...
const { ready, authenticated } = useRookAuth()
...
}
0.3.0

2 years ago

0.5.0

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.5.1

2 years ago

0.2.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago