Skip to main content
For a more granular control over your authentication flow, you can use the @scute/react-hooks package. This package exposes the useAuth and useScuteClient hooks, which allow you to build your own custom UI while still leveraging Scute’s authentication logic. Head over to the example projects repo to see the hooks in action and check out the type docs for more scuteClient methods. To get started, install our React SDK with your favorite package manager:
Terminal
Add your credentials to your environment variable handler:
NOTE: If you are not using Vite, use “REACT_APP” as your prefix for your environment variables.

Initialize the Scute client

First initialize the Scute client using the createClient method exposed by @scute/react-hooks package:

Wrap your React app with Scute AuthContextProvider

To be able to use the useScuteClient and useAuth hooks, wrap your app inside the Scute AuthContextProvider:

Using the hooks

Now you can use the useAuth and useScuteClient hooks in your components.

useAuth

The useAuth hook provides access to the authentication state and the current user.

useScuteClient

The useScuteClient hook provides access to the Scute client instance.