moggelitalanya
moggelitalanya
Explore posts from servers
KKinde
Created by moggelitalanya on 12/18/2024 in #💻┃support
NextJS API endpoint - verify token
Ive ran with the nextjs API as ive learned that its very simple to setup and hosted within your domain (automatically), this might be the case with tRPC aswell? Thank you again, i will surely get further with this information. If not, i will return , hehe. Have a good night!
13 replies
KKinde
Created by moggelitalanya on 12/18/2024 in #💻┃support
NextJS API endpoint - verify token
I see, that makes sense, i was not totally aware that there is a difference in "server-action" and "server-component", if i understood that right. I noticed that i did not mention that im aiming on using this API for other platforms later (example react native), meaning im aiming on making the DB fetch on the API. I got reminded of that due to your example fetching the DB in server-component. Does this makes sense? Thank you so far, really appreciate it.
13 replies
KKinde
Created by moggelitalanya on 12/18/2024 in #💻┃support
NextJS API endpoint - verify token
addition, ive tried out adding the "getIdTokenRaw" to the request-header and can get the token from the user from there, how would i then validate this token to Kinde. Just an idea.
13 replies
KKinde
Created by moggelitalanya on 12/18/2024 in #💻┃support
NextJS API endpoint - verify token
middleware.ts import { withAuth } from "@kinde-oss/kinde-auth-nextjs/middleware"; export default withAuth(async function middleware() {}, { isReturnToCurrentPage: true, }); export const config = { matcher: [ "/((?!api|_next/static|_next/image|auth|favicon.ico|robots.txt|images|login|$).*)", ], }; One of my endpoints, route.ts (domain.xx/api/tasks), keeping it simple for this example, also added example desired functionallity: export async function GET(req: Request) { try { //more complex to check role etc later const { isAuthenticated } = getKindeServerSession(); const isAuth = await isAuthenticated(); if(!isAuth){ return NextResponse.json( { error: "Failed to get tasks" }, { status: 500 }, ); } const data = await db.task.findMany({}); return NextResponse.json(data); } catch (error) { console.log(error); } } function for calling and returning data (nextjs server-action): export const getAllTasks = async () => { try { const response = await fetch( ${process.env.NEXT_PUBLIC_API_URL}/api/tasks, { credentials: "include", headers: { "Content-Type": "application/json", }, }, ); const data = await response.json(); return data; } catch (error) { return { success: false, error: error }; } }; Hopefully this helps.
13 replies
KKinde
Created by moggelitalanya on 12/5/2024 in #💻┃support
React Native - expo
hi @Yoshify , just wanted to give an update on this request. Ive unforunaly had to pause the development on the React Native application. I will try this out as soon as i pick it up again. Sorry!
6 replies
KKinde
Created by moggelitalanya on 12/5/2024 in #💻┃support
React Native - expo
Lovely support @Yoshify 🙏
6 replies
KKinde
Created by moggelitalanya on 12/5/2024 in #💻┃support
React Native - expo
@Yoshify , ahh, as I figured when reading the docs. Great idea, I will try this ASAP! If not possible i will def do a feature request on this 🙂 Thanks again.
6 replies
KKinde
Created by moggelitalanya on 11/22/2024 in #💻┃support
Get current user role
Works like a charm, thank you very much 🙂
5 replies
KKinde
Created by moggelitalanya on 11/22/2024 in #💻┃support
Get current user role
Thank you so much, I never considered to use the access token like this , focusing so hard on the USER object . Thank you again , I will try this ASAP 🤗
5 replies
KKinde
Created by Samyam on 11/6/2024 in #💻┃support
How to get role of the current logged in user
Hello! Where did you find this option in the control-panel? Thank you in advance. @IkiTg07 EDIT: Found it, this solved my issue with not getting roles when calling "getRoles" from "getKindeServerSession". Found under: Kinde Settings > Application > Tokens >AccessToken > Roles switched on. For future reference. ‼️ Though, im still looking for getting the current role when fetching "getUser" .
5 replies
SSolidJS
Created by moggelitalanya on 2/6/2024 in #support
Routes import issue
Thanks a lot! 👍
7 replies
SSolidJS
Created by moggelitalanya on 2/6/2024 in #support
Routes import issue
Alright, thanks! Any idea of where i can read on how to create changes to website url , as the documentation (as a beginner) is faulty?
7 replies
SSolidJS
Created by moggelitalanya on 2/6/2024 in #support
Routes import issue
Grabbed the latest yesterday, 1.8.7, i see now that there were an update 12 hours ago. How would i go by with using routes ? I am following the documentation Thanks.
7 replies