KindeK
Kinde2y ago
Jens

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
YouTubeJosh tried coding
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...
Was this page helpful?