8base Auth
The 8base Auth package contains provider with authentication state and auth helpers.
AuthProvider
Table of Contents
AuthProvider
Extends Component
Provides access to the authentication state.
Properties
children
React$Node Children of the provider.authClient
AuthClient Instance of the auth client.
Auth0WebClient
Create instacne of the auth web zero0 client.
Parameters
options
AuthClientOptionsworkspaceId
string Identifier of the 8base app workspace.domain
string Domain. See auth0 documentation.clientID
string Client id. See auth0 documentation.redirectUri
string Redurect uri. See auth0 documentation.
Usage
Simple Usage
import { AuthProvider, Auth0WebClient, AuthConsumer } from '@8base/auth';
const auth0WebClient = new Auth0WebClient({
domain: 'domain',
clientID: 'client-id',
redirectUri: `${window.location.origin}/auth/callback`,
logoutRedirectUri: `${window.location.origin}/auth`,
workspaceId: 'workspace-id',
});
<AuthProvider authClient={ auth0WebClient }>
...
<AuthConsumer>
{
(auth: AuthContextProps) => (<div />)
}
</AuthConsumer>
...
</AuthProvider>