Jens
KKinde
•Created by Jens on 1/11/2024 in #💻┃support
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
6 replies