Day 087 - Project 87 : Authenticate

If you have any questions, comments or issues with this project please post them here!

Does Repl Auth manage session handling or should I still incorporate that into my web applications?

Yes, Repl auth handles that. You can use replit.web to see if the user is authenticated and access name, id, and roles instead of using headers.

...
from replit import web

...

@web.authenticated
@app.route('/')
def index():
    return f'Hello, {web.auth.name}! Your Replit ID is {web.auth.id}.'
1 Like

Thank you! I had a feeling that that wouldn’t be a feature that the reply team would overlook but I just wanted to make sure. Thanks again!

1 Like

How do actually log out now with the authentication if you get kicked back to /edit and username == True?

It’s taken quite a few goes of disabling and enabling the authentication plus adding some html to an @app.route("/log_out") but to me it seems very hit and miss… maybe I’m not doing it correctly?

Is there a full proof way to get back to here:

It’s not really designed to enable logging out, you can re-login. Ultimately, to log out, you’d have to delete the REPL_AUTH (or whatever it’s called) cookie and refresh the page.

1 Like