K
Kinde14mo ago
Martin

Accessing appState

https://kinde.com/docs/developer-tools/react-sdk/#persisting-application-state gives an example for how to handle redirecting back to the page a user was on before they clicked the login button. However, as per https://discord.com/channels/1070212618549219328/1161828367511859291/threads/1174693165748461628 I'm currently redirecting the user to a special page which handles making an API call to map them into an organisation based on some business logic. This means I want to wait until that API call completes before I redirect back to the original URL. To enable this I'm currently using a big hack:
onRedirectCallback={(_user, appState) => {
if (appState?.redirectTo) {
// TODO: This is a hack to get around the fact that we don't have access to the
// kinde_redirect_to in a persistant way. We need to set this in index.jsx and
// read it in AssignOrg.tsx.
window["kinde_redirect_to"] = appState?.redirectTo;
}
}}
onRedirectCallback={(_user, appState) => {
if (appState?.redirectTo) {
// TODO: This is a hack to get around the fact that we don't have access to the
// kinde_redirect_to in a persistant way. We need to set this in index.jsx and
// read it in AssignOrg.tsx.
window["kinde_redirect_to"] = appState?.redirectTo;
}
}}
Is there a better way of doing this? I couldn't see anything returned from useKindeAuth() which exposed the appState.
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Kinde Docs
React SDK - Developer tools - Help center
Our developer tools provide everything you need to get started with Kinde.
1 Reply
VKinde
VKinde14mo ago
I'll reach out to the team and let you know about this. I believe there should be some way to get the domain information before you make the login request, so you can just if/else statement into different org buckets so you can skip that middleman step altogether but I'm gonna double check on this would be done.
Want results from more Discord servers?
Add your server