-
-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
devel: rest api token auth #469
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,5 +23,20 @@ <h2>Developer Profile</h2> | |
<p><label></label> <input title="Save changes" type="submit" value="Save" /></p> | ||
</form> | ||
|
||
<form id="api-profile-form" enctype="multipart/form-data" method="post" action="">{% csrf_token %} | ||
<h3>API token</h3> | ||
<p>Token for completing todolist items with for example, rebuild-todo</p> | ||
{% if profile.api_token is None %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume it would be a good pattern to be able to revoke a token, or to phrase it differently: Generate a new token and invalidate the existing one. |
||
<fieldset> | ||
<input type="hidden" name="api_token" id="api_token" value="generate"> | ||
</fieldset> | ||
<p><label></label> <input title="Generate token" type="submit" value="Generate API Token" /></p> | ||
{% else %} | ||
<fieldset> | ||
<label>Token:</label> | ||
{{ profile.api_token }} | ||
</fieldset> | ||
{% endif %} | ||
</form> | ||
</div> | ||
{% endblock %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it make sense to use
Authorization: Bearer
as header, this is a quite widely used way for such API and would also allow a lot of HTTP clients to use implemented helper methods for authenticate a request with a token. Otherwise you'd need to pass around custom header strings likeX-Archweb-Token
.What are your thoughts about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds fine to me, it shouldn't conflict with things I suppose.