Logging out manually/ending session and redirect
Dear everyone,
I am extending an application built in this YT-Tutorial (https://www.youtube.com/watch?v=ucX2zXAZ1I0) using NextJS 13.5.4, (AppRouter) TypeScript, trpc for requests and Kinde for Auth management.
My problem is as follows: When logged in, i wanted to give a User the possibility to delete all his files and finally his account (in my Prisma DB and at Kinde).
I managed to do this, at the and of this request however, I would like to automatically log the user out and end his active Kinde session (such that using the "Back"-Click in the browser does not bring me back in my application (as it crashes the application)) and redirect the User to the front page of the app.
I have searched through this discord and the threads around this topic did not resolve my problem so far (or I didn't succeed).
You can find the Github repository here:
https://github.com/Herold1989/torpedochat
The corresponding file snippets are:
Client-Side: Settings.tsx to manage logging out and redirecting
Server-Side: Page.tsx (for the Settings-Component)
and the file containing the trpc - requests, where optimally a request ending the session would be added to the "deleteUser"-request.
Any help is highly appreciated - happy coding! Cheers, Jens
Josh tried coding
YouTube
Build a Complete SaaS Platform with Next.js 13, React, Prisma, tRPC...
In this single video, we're building an entire, modern SaaS Platform from beginning to end.
⭐Kinde Auth: https://link.joshtriedcoding.com/kinde
⭐Discord for questions/answers: https://discord.gg/4vCRMyzgA5
⭐GitHub Repo: https://github.com/joschan21/quill
Full Feature List:
🛠️ Complete SaaS Built From Scratch
💻 Beautiful Landing Page & Pricing...
4 Replies
Hi @Jens,
Thanks for reaching out and passing on your code.
I have reached out to my team on this issue.
I will get back to you once I have more information.
Hi @Jens,
The following Github repo link leads to a 404 error: https://github.com/Herold1989/torpedochat
Anyway we can access this repo?
Hi-thanks for reaching out. the repository is now public-wasn‘t aware I had set it up private. The link should work now
Awesome, thanks for this.
I will pass this onto my NextJS teammate on Monday.
Have a good weekend.