Closed alexmartinezm closed 1 month ago
Thanks @alexmartinezm, sorry about that - you're right!
I'll have to merge PR #16 for the documentation to be correct.
resolved in v1.1.1
resolved in v1.1.1
Hey @peterphanouvong, I've added a comment on #16. It's solved but returned user is null.
thanks @alexmartinezm, let me look at it again
@alexmartinezm would you be able to provide any extra info about your project? Unfortunately I wasn't able to recreate the user being null with some of the code that you provided:
import { LoaderFunctionArgs } from "@remix-run/node";
export async function loader({ params, request }: LoaderFunctionArgs) {
return await handleAuth(request, params.index, {
onRedirectCallback: async (props) => {
if (!props.user) {
console.error("User not found", props);
return;
}
const { user } = props;
console.log("user", user);
},
});
}
Does your project Error out?
@alexmartinezm would you be able to provide any extra info about your project? Unfortunately I wasn't able to recreate the user being null with some of the code that you provided:
import { LoaderFunctionArgs } from "@remix-run/node"; export async function loader({ params, request }: LoaderFunctionArgs) { return await handleAuth(request, params.index, { onRedirectCallback: async (props) => { if (!props.user) { console.error("User not found", props); return; } const { user } = props; console.log("user", user); }, }); }
Does your project Error out?
Hey Peter, I just reverted the Vercel dependencies and now I'm using @remix-run/node
instead. However, I still got the same error. Please, see the screenshot below:
The rest of the project is quite simple, I don't have any special deps. My package.json:
"dependencies": {
"@kinde-oss/kinde-remix-sdk": "^1.1.1",
"@neondatabase/serverless": "^0.9.4",
"@remix-run/node": "^2.11.2",
"@remix-run/react": "^2.11.2",
"drizzle-orm": "^0.33.0",
"isbot": "^5.1.17",
"pino": "^9.3.2",
"pino-pretty": "^11.2.2",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
As a final note, I'm using an Email/Password authentication method on Kinde.
Hey @peterphanouvong, any ideas? Thanks in advance!
Aw man @alexmartinezm still no luck recreating and trying to copy your setup :( Would you be okay with sending over a github repo with the issue reproduced? That would help us out a lot.
The only thing I can think of is maybe the the code isn't in the file app/routes/kinde-auth.$index.tsx
?
Aw man @alexmartinezm still no luck recreating and trying to copy your setup :( Would you be okay with sending over a github repo with the issue reproduced? That would help us out a lot.
The only thing I can think of is maybe the the code isn't in the file
app/routes/kinde-auth.$index.tsx
?
Yes, it is placed there. Let me invite you to the repo!
Hey @alexmartinezm I managed to reproduce it! Looks like its only happening for the bundled version which is weird. I'm going to have a dig and see if I can work out whats going on. Thanks for sending the repo through and sorry for the weird bug!!
Hey @alexmartinezm I managed to reproduce it! Looks like its only happening for the bundled version which is weird. I'm going to have a dig and see if I can work out whats going on. Thanks for sending the repo through and sorry for the weird bug!!
Oh! I'm glad that you could reproduce it. Thanks for looking into, Peter!
hey @alexmartinezm should now be fixed in v1.1.3 https://www.npmjs.com/package/@kinde-oss/kinde-remix-sdk/v/1.1.3
hey @alexmartinezm should now be fixed in v1.1.3 https://www.npmjs.com/package/@kinde-oss/kinde-remix-sdk/v/1.1.3
Hey there! Didn't have a chance to check the latest version. Unfortunately, still now working.
I made a fresh package install but the props from onRedirectCallback are undefined.
Forget it, I had to clean the pnpm registry to make it work. Thanks!
Prerequisites
How can we improve the docs or what is missing?
The current documentation for the
onRedirectCallback
function appears to be misleading or outdated. Specifically, it suggests that thehandleAuth
function accepts a third parameter, which can be used to define a callback to be executed after user authentication. However, based on my experience, thehandleAuth
function only accepts two parameters:request: Request
androute: any
. This discrepancy makes it difficult to implement the feature as described.To improve the docs, please either:
onRedirectCallback
with the current implementation.Including a more comprehensive example or a note about any recent changes to the function’s signature would be very helpful.
Provide extra context, such as what you were trying to do and your requirements
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:
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.
If the docs page already exists, please provide a link
https://docs.kinde.com/developer-tools/sdks/backend/remix-sdk/#call-a-function-after-authentication