Authsignal Next.js helpers
Installation
Add the @authsignal/nextjs-helpers
package to your package.json
.
npm
npm install @authsignal/nextjs-helpers
yarn
yarn add @authsignal/nextjs-helpers
Usage
Wrap your top level app component with AuthsignalProvider
:
import {AuthsignalProvider} from "@authsignal/nextjs-helpers";
function MyApp({Component, pageProps}: AppProps) {
return (
<AuthsignalProvider>
<Component {...pageProps} />
</AuthsignalProvider>
);
}
Then you can use the useAuthsignal
hook to access the Authsignal browser client:
import {useAuthsignal} from "@authsignal/nextjs-helpers";
function MyPage() {
const authsignalClient = useAuthsignal();
}
Learn more about the Authsignal browser client in the API documentation.