AuthProvider component, which integrates seamlessly with Tailor Platform’s Auth service. The provider supports any IdP configured in your Tailor Platform application (built-in IdP, Google, Okta, Auth0, etc.).
Quick start
Wrap your AppShell with the authentication provider:Configuration values
Find these values in your Tailor Platform console:App URI
Your application’s base URL obtained from the Application Overview screen.- Found in: Application Overview > “Accessing the API endpoint of this application”
- Use the domain portion only (no
/querysuffix) - Example:
"https://xyz.erp.dev"
Client ID
Authentication client identifier.- Found in: Application > Auth screen
- Example:
"my-app-client"
Redirect URI (optional)
OAuth2 callback URL after authentication.- Defaults to
window.location.originif not provided - Must match the redirect URI configured in Tailor Platform Auth settings
- Example:
"https://myapp.com"
Provider behavior
With the above configuration:- Auto-login: Unauthenticated users automatically redirect to login (when
autoLogin={true}) - Guard component: Shows loading/unauthenticated state while checking auth status
- Token management: Handles token storage, refresh, and session persistence automatically
- OAuth callback: Processes OAuth redirects and cleans up URL parameters
Authentication hook
Use theuseAuth hook to access authentication state and methods:
Authentication state
TheuseAuth hook returns:
Suspense integration
For React Suspense compatibility, useuseAuthSuspense:
useAuthSuspense throws a promise during the initial auth check, allowing Suspense boundaries to handle loading states.GraphQL integration
The auth client provides a helper method for authenticated GraphQL requests:Custom endpoints
ThegetAuthHeadersForQuery method accepts custom paths:
OAuth callback handling
In most cases, the
AuthProvider handles OAuth callbacks automatically. Use handleCallback only if you need a dedicated callback page.Integration with AppShell
The authentication provider works seamlessly with AppShell’s data layer:1
OAuth2 token management
Automatically handles token storage and refresh
2
GraphQL authentication
Provides DPoP-bound tokens for secure API requests
3
Session persistence
Maintains sessions across page reloads
4
Route protection
Works with route guards for protected routes
Example: Protected routes
Combine authentication with route guards:Related
Modules and resources
Learn about route guards for access control
API reference
Complete authentication hook API documentation