@riseact/nextjs-sdk
v1.4.4
Published
Riseact SDK for Next.js
Downloads
13
Readme
Riseact SDK
Next helpers
Configure Riseact
Create a file called [...riseact].js in pages/api/auth. This contains the dynamic route handler for Riseact which will also contain all of your global Riseact configurations.
import { AuthHandler } from "riseact";
export default AuthHandler({
nextHost: "http://localhost:3000",
riseactHost: "https://riseact.org",
clientId: "<your-client-id>",
clientSecret: "<your-client-secret>",
errorPagePath: "/error",
successPagePath: "/",
callback: async (accessToken, refreshToken) => {
// do something with the user's credentials
// if error is thrown, user will be redirected to /error
await saveCredentials(accessToken, refreshToken);
},
});
All requests to /api/auth/* (install, redirect) will automatically be handled by Riseact.
Install the app
Visit localhost:3000/api/auth/install