I need to do a logout button. I use Flask and Python and my website uses basic authentication so as to log in. I found out that the only possible way to log out is to close a browser (which is not what I'm looking for) or to change already entered login and password doing something like this:
user:[email protected]:8000
It works when I input that phrase in URL but I'd like to do it programmatically.
My Python code:
@app.route('/logout')
@auth.login_required
def logout():
urlparameter = "user:[email protected]:8000"
return Response(render_template('logout.html', urlparameter=urlparameter, mimetype='text/html'))
HTML button:
<a href="{{ urlparameter }}">Logout</a>
However, it doesn't work. How should I change it? Thanks