Ask coding questions

← Back to all posts
JBloves27 (1720)

Uh, so the title says all. Im making a flask website, but I'm trying to add repl auth or some kind of auth so only specific people can post and comment, etc. Could any of you guys put example auths in the comments? I'll attach repl if I have to. Another thing I should mention is that I'm using HTML and python.
Thanks! - JB

Answered by ch1ck3n (1630) [earned 5 cycles]
View Answer
ch1ck3n (1630)

first put <script authed="location.reload()" src=""></script> to where you want the auth button to be in your HTML.

and once authed it will reload the page and send headers. user-id, user-name, and user-roles.

	return render_template(

this will give the template context of what the username is.

	{% if user_name %}
	<h1>Hello, {{ user_name }}!</h1>
	{% else %}
	Hello! Please log in.
		<script authed="location.reload()" src=""></script>
	{% endif %}
JBloves27 (1720)

thanks! ill let u know with the results (even tho ur in repl lol) @ch1ck3n