2.2.12 • Published 1 year ago

react-curity v2.2.12

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Get started

A library using the plain vanilla javascript @curity/oauth-assistant library and adds React Context and hooks on top of it.

Import library with desired version

"react-curity": "^2.2.12"

Create a useAuth context file

e.g. under 'hooks/useAuth.ts' with following content

import {useContext} from 'react'
import {AuthContext, AuthContextValue} from 'react-curity'

const useAuth = () => useContext<AuthContextValue>(AuthContext as any)

export default useAuth

Add AuthProvider into yout index.tsx as App parent

import {AuthProvider} from 'react-curity'

<AuthProvider curityConfig={AUTH} fetchMe={() => API.get(`${API_URL}/users/me`)}>
  <App />
</AuthProvider>

Use the hooks in your components

const { loginWithRedirect, registerWithRedirect, logout, user, isAuthenticated } = useAuth()
2.2.11

1 year ago

2.2.12

1 year ago

2.2.1

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.2.3

2 years ago

2.1.4

2 years ago

2.2.2

2 years ago

2.1.3

2 years ago

2.2.5

2 years ago

2.1.6

2 years ago

2.2.4

2 years ago

2.1.5

2 years ago

2.2.7

2 years ago

2.1.8

2 years ago

2.0.9

2 years ago

2.2.6

2 years ago

2.1.7

2 years ago

2.0.8

2 years ago

2.2.10

2 years ago

2.1.0

2 years ago

2.2.9

2 years ago

2.2.8

2 years ago

2.1.9

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago