dave_kinde
dave_kinde
KKinde
Created by LIFE on 3/23/2024 in #💻┃support
How to get organization name in React SDK
Ah perfect!
4 replies
KKinde
Created by LIFE on 3/23/2024 in #💻┃support
How to get organization name in React SDK
Hey @LIFE that looks correct to me. I wonder if there is some caching going on with the token. Does it appear if you log in and out again with the user?
4 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
Like a rocket
20 replies
KKinde
Created by Martin on 2/1/2024 in #💻┃support
Wildcards in callback URLs bug
The way I've done auto-forwarding before is
import { useEffect } from "react";
import { useKindeAuth } from "@kinde-oss/kinde-auth-react";

...

const { login, isAuthenticated, isLoading } = useKindeAuth();
useEffect(() => {
if (!isAuthenticated && !isLoading) {
login();
}
}, [isAuthenticated, login, isLoading]);
import { useEffect } from "react";
import { useKindeAuth } from "@kinde-oss/kinde-auth-react";

...

const { login, isAuthenticated, isLoading } = useKindeAuth();
useEffect(() => {
if (!isAuthenticated && !isLoading) {
login();
}
}, [isAuthenticated, login, isLoading]);
37 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
I'd love that
20 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
That makes sense, it would be pretty low effort to add
20 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
I mean it we could add it for sure, but I wonder if it makes things more confusing
20 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
I'm not sure we need a getUser as well which would essentially return the same thing as user
20 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
@sszczep Looking again, you're totally right. I think I've just been in the habit of using
const {user} = useKindeAuth()
const {user} = useKindeAuth()
20 replies
KKinde
Created by Martin on 2/1/2024 in #💻┃support
Wildcards in callback URLs bug
Hey @Martin are you able to share the code that is doing the auto-redirecting, or provide a small reproducible example?
37 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
Hey @LIFE I think the problem you're facing is that getUser isn't async, but essentially you're probably better off grabbing the user object as suggested by @sszczep (thanks for jumping in by the way)
20 replies
KKinde
Created by DJKnaeckebrot on 2/26/2024 in #💻┃support
Post Logout Redirect Parameter
It's definitely possible but I do prefer the separation of concerns. The callback for login contains a fair bit of logic that isn't relevant for logging out
66 replies
KKinde
Created by DJKnaeckebrot on 2/26/2024 in #💻┃support
Post Logout Redirect Parameter
Eitherway I am just wondering if this SDK still should be able to do this without making this "workaround" with the custom logout page? If so I might can try to dig deeper on why it wont pass/use the param 🙂
I did wonder this myself. There are 3 ways of handling the param that I can think of 1. The param override to the .env variable setting, so it would get passed to Kinde and we redirect straight to it. This would mean the dynamic URL would need to exist in Allowed logout redirect URLs in the admin area This seems to be both of your expected behaviour. I like that there is no additional code needed but this would mean the behaviour was different to the post_login_redirect_url param which could be confusing. Also could mean a lot of URLs having to be added to the allow list 2. As it is now, the .env variable is used for the initial logout redirect and the param is stored in the Session Manager and can be used in a custom logout page set up by the founder. I like that this gives flexibility to the dev, possibly just documentation thing, although more setup needed than the above 3. Similar to 2, except we provide an additional api/auth/post-logout handler within the SDK that essentially provides the code snippet above for you. So in theory you can then just add api/auth/post-logout to the Allowed Logout Callback URls - this seems like a nice hybrid solution Would love to hear your thoughts
66 replies
KKinde
Created by DJKnaeckebrot on 2/26/2024 in #💻┃support
Post Logout Redirect Parameter
Haha, sadly not the issue in this case, and definitely not dumb! Thanks for raising this one @Joel @DJKnaeckebrot and sorry it's taken me so long to get to it. I'll just provide some context There is the .env variable KINDE_POST_LOGOUT_REDIRECT_URL this typically is the one that you would have mapped in the Kinde admin area in the Allowed logout redirect urls - if it isn't mapped there then it will fall back to a default Kinde log out screen. There is then the argument to <LogoutLink /> which is post_logout_redirect_url the idea of this one is to be able to provide dynamic logout URLs that differ from the default. The idea was that this way you could add a single logout url to the allow list (as it could be a headache to add every conceivable url) and then forward the user onwards on return to your application. (This is the same way the post_login_redirect_url argument works for logging in - typically that is used to remember where they were trying to visit). With the LoginLink argument the param is stored in the NextJS SessionManager - essentially just a cookie which can be accessed when you are redirected back from Kinde. One approach you could use (I should add a caveat here that I am not a NextJS expert by any means) is having a global logout route (could also be middleware I expect) something like: .env
KINDE_POST_LOGOUT_REDIRECT_URL=http://localhost:3000/api/logout
KINDE_POST_LOGOUT_REDIRECT_URL=http://localhost:3000/api/logout
^ this should also be added in Allowed logout redirect URLs /api/logout
import { cookies } from "next/headers";
import { NextRequest, NextResponse } from "next/server";

export async function GET(request) {
const cookieJar = cookies();

const path = cookieJar.get("post_logout_redirect_url").value;

return NextResponse.redirect(new URL(path, request.url));
}
import { cookies } from "next/headers";
import { NextRequest, NextResponse } from "next/server";

export async function GET(request) {
const cookieJar = cookies();

const path = cookieJar.get("post_logout_redirect_url").value;

return NextResponse.redirect(new URL(path, request.url));
}
The /api/logout is then able to handle any values passed to <LogoutLink post_logout_redirect_url="/some-where-else" />
66 replies
KKinde
Created by Colin on 2/10/2024 in #💻┃support
Permissions and roles not updating after a change using the Nuxt module
Hey @Colin there are a few different ways of checking roles / permissions 1. Using the Management API - this will be real time. You could poll it and keep an internal store but obviously that incurs additional network requests. 2. Using the SDK helper methods which read from the access token. This is super convenient and saves on network requests but does suffer from the eventual consistency problem where there will be a window that updates in the Kinde admin UI are not yet reflected in the token depending on the access token lifetime you have set, 1+2. You could use a hybrid of a short access token lifetime combined with using the management API to protect highly sensitive areas of your product. Coming soon 3. Webhooks are right around the corner and give you the best of both worlds. This would allow you to subscribe to a user update event and based on that either request a new access token or update an internal store. We should have Beta access available for that any day now if you're keen to give them a go.
13 replies
KKinde
Created by Deck on 2/4/2024 in #💻┃support
Dark Mode & Multiple Organization Login
@Deck the fix for this should be in now, can you let me know if resolved when you get a sec
10 replies
KKinde
Created by Deck on 2/4/2024 in #💻┃support
Dark Mode & Multiple Organization Login
Thanks @Deck sounds like possibly a Windows native select issue. Hopefully should be a quick CSS fix - getting onto it now
10 replies
KKinde
Created by Deck on 2/4/2024 in #💻┃support
Dark Mode & Multiple Organization Login
No description
10 replies
KKinde
Created by Deck on 2/4/2024 in #💻┃support
Dark Mode & Multiple Organization Login
No description
10 replies
KKinde
Created by Martin on 11/23/2023 in #💻┃support
Use of history.pushState in createKindeClient.ts
Hey @Martin , thanks for flagging this. I've responded on the issue as well, but putting here as well for discoverability. We can definitely update it to replaceState but it would come with it's own caveats. If we make it replaceState and the user clicks the back button they would return to the Kinde auth flow - however each login flow can only be run once for security, so they would end up seeing an error screen as that instance of the auth flow has already completed. Just trying to understand the use case where do you anticipate the user is trying to access when they click the Back button?
5 replies