MadLex
MadLex
KKinde
Created by MadLex on 8/26/2024 in #💻┃support
Remix: onRedirectCallback Functionality in Documentation
The current documentation for the onRedirectCallback function appears to be misleading or outdated. Specifically, it suggests that the handleAuth function accepts a third parameter, which can be used to define a callback to be executed after user authentication. However, based on my experience, the handleAuth function only accepts two parameters: request: Request and route: any. This discrepancy makes it difficult to implement the feature as described. I was trying to call the onRedirectCallback function after a user has been successfully authenticated, as per the instructions provided in the documentation. My goal was to execute some custom logic after the authentication step, such as logging user information. Here’s the specific code I used:
import {handleAuth} from "@kinde-oss/kinde-remix-sdk";
import {LoaderFunctionArgs} from "@remix-run/node";

export async function loader({params, request}: LoaderFunctionArgs) {
return await handleAuth(request, params.index, {
onRedirectCallback({user}) {
console.log("This is called after the user is authenticated!", user);
}
});
}
import {handleAuth} from "@kinde-oss/kinde-remix-sdk";
import {LoaderFunctionArgs} from "@remix-run/node";

export async function loader({params, request}: LoaderFunctionArgs) {
return await handleAuth(request, params.index, {
onRedirectCallback({user}) {
console.log("This is called after the user is authenticated!", user);
}
});
}
Unfortunately, this approach doesn't work because handleAuth seems to only accept two parameters, not three as indicated. My requirement is to be able to execute a function after authentication, and it’s unclear from the documentation how to correctly implement this. A clear, updated example or additional guidance on handling post-authentication logic would greatly assist developers in using this SDK effectively. Here's the GitHub issue I created a week ago: https://github.com/kinde-oss/kinde-remix-sdk/issues/17 Best Regards!
13 replies