Skip to content
Sign upLog in
← Back to Community

How to log out of Repl Auth in node js?

Profile icon
DREWNOLT

I have been working on an account system, lately, and I want to make a way for users to sign out of the Replit Auth System. I am using a node js server for this project.

Voters
Profile icon
DREWNOLT
Comments
hotnewtop
Profile icon
PhillipConrad

I'm trying to do the same thing, but with Flask. It is not working for me. This is what I'm trying:

@app.route("/logout") @web.authenticated def logout(): resp = make_response("You are logged out") resp.set_cookie('REPL_AUTH', expires=0) return resp;

I also tried:

resp.delete_cookie('REPL_AUTH')

In both cases, the page returned just fine, but when I went back to the home page, I was still logged in.

Profile icon
19wintersp

The Repl Auth session is stored in a cookie called "REPL_AUTH". If you can clear that cookie, the user should be logged out.

Profile icon
DREWNOLT

@19wintersp
how do i clear a cookie? I don't really have much programming experience with cookies.

Profile icon
19wintersp

@DREWNOLT
It depends on the framework you're using. Express? Flask?

Profile icon
DREWNOLT

@19wintersp
express

Profile icon
19wintersp

@DREWNOLT
In the request where you want to log them out (assuming res is the Response object), you can use this:

res.clearCookie("REPL_AUTH");

More information

Profile icon
Coder100

imagine not just changing the expiration date to null can't relate

@19wintersp

Profile icon
19wintersp

@Coder100
Why would you do that?

Profile icon
DREWNOLT
Profile icon
19wintersp

@DREWNOLT
It's a different method of doing this; using clearCookie is easier in my opinion.