Closed mouise1111 closed 1 month ago
This isn't a TypeScript error but a syntax error. handleAuth
only accepts one property in its options object, and onSuccess
isn't it.
If you want to add custom logic to the callback handler, you can do something like this:
import { handleAuth } from "@workos-inc/authkit-nextjs";
import { NextRequest } from "next/server";
export async function GET(request: NextRequest) {
const response = await handleAuth()(request);
// Do custom logic here
// Return the response or redirect
return response;
}
TypeScript Error: 'onSuccess' not recognized in HandleAuthOptions
Description
When using the
handleAuth
function from@workos-inc/authkit-nextjs
, I'm encountering a TypeScript error during the build process (npm run build
). The error occurs when trying to add custom logic to handle successful authentication.Current Code
Error Message
Additional Context
This code works locally but fails during the build process. The previous implementation without custom logic worked fine:
Any guidance on how to properly type the
onSuccess
callback or alternative approaches to achieve this functionality would be greatly appreciated.