Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: use a better name for on success response since we allow NextRe…
…sponse and not just redirects
  • Loading branch information
axlEscalada committed Oct 14, 2025
commit 73cc82ac574d644af6580136495f9bf958a73616
6 changes: 3 additions & 3 deletions src/authkit-callback-route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function handleAuth(options: HandleAuthOptions = {}) {
await saveSession({ accessToken, refreshToken, user, impersonator }, request);

if (onSuccess) {
const redirect = await onSuccess({
const onSuccessResponse = await onSuccess({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I wonder if it makes sense to provide the default response as an argument to onSuccess? That way, you don't always need to create a new one from scratch.

This would also help make it more explicit that if onSuccess returns a NextResponse, it's going to take precedence over returnPathname if both are provided.

accessToken,
refreshToken,
user,
Expand All @@ -107,8 +107,8 @@ export function handleAuth(options: HandleAuthOptions = {}) {
state: customState,
});

if (redirect) {
return redirect;
if (onSuccessResponse) {
return onSuccessResponse;
}
}

Expand Down
Loading