bazar21
KKinde
•Created by bazar21 on 1/17/2025 in #💻┃support
What is the proper way to test if user is authenticated?
I am using sequence below to test if a user is authenticated or not. However, this causes an async call to kinde as I understand for each isAuthenticated() for ex.
Is there a better way to handle this and obtain the authentication status?
const { getUser, isAuthenticated } = getKindeServerSession();
const authenticated = (await isAuthenticated());
const newuser = await getUser();
if (authenticated) { const newuser = await getUser();
if (authenticated) { const newuser = await getUser();
3 replies
KKinde
•Created by bazar21 on 1/6/2025 in #💻┃support
How to process an action post sign-up or login
I am looking to save new user details once a usr sign-up to my site.
As of now I see there is a way to do that here: https://docs.kinde.com/developer-tools/sdks/frontend/javascript-sdk/#handle-redirect
But where am I supposed to put the codebelow?
on_redirect_callback: (user, appState) => {
console.log({user, appState});
if (user) {
// render logged in view
} else {
// render logged out view
}
};
I sense I am missing something as I don't have a proper place to put this into as my sign-up/login/logout works ok, just need to save new sign-up details in database and need a place to put that action on a post sign-up event.
7 replies