2.2.12 • Published 3 years ago
react-curity v2.2.12
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
3 years ago
2.2.12
3 years ago
2.2.1
3 years ago
2.1.2
3 years ago
2.1.1
3 years ago
2.2.3
3 years ago
2.1.4
3 years ago
2.2.2
3 years ago
2.1.3
3 years ago
2.2.5
3 years ago
2.1.6
3 years ago
2.2.4
3 years ago
2.1.5
3 years ago
2.2.7
3 years ago
2.1.8
3 years ago
2.0.9
3 years ago
2.2.6
3 years ago
2.1.7
3 years ago
2.0.8
3 years ago
2.2.10
3 years ago
2.1.0
3 years ago
2.2.9
3 years ago
2.2.8
3 years ago
2.1.9
3 years ago
2.0.7
3 years ago
2.0.6
3 years ago
2.0.5
3 years ago
2.0.4
3 years ago
2.0.3
3 years ago
2.0.2
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago