{% extends 'layout.twig' %} {% block title %}Tokens — IRDB{% endblock %} {% block content %} {% import 'partials/sort.twig' as sort %}

API tokens

{{ list.total|default(0) }} total
{% if can_write %}

Issue token

{% endif %}
{{ sort.th('Kind', 'kind') }} {{ sort.th('Prefix', 'prefix') }} {{ sort.th('Role / target', 'role_target') }} {{ sort.th('Issuer', 'issuer') }} {{ sort.th('Last used', 'last_used', 'date') }} {{ sort.th('Status', 'status') }} {% if can_write %}{% endif %} {% for t in list.data|default([]) %} {% set role_target_value = (t.kind == 'admin') ? ('role:' ~ (t.role|default(''))) : ((t.kind == 'reporter') ? ('reporter:' ~ t.reporter_id) : ((t.kind == 'consumer') ? ('consumer:' ~ t.consumer_id) : '')) %} {% if can_write %} {% endif %} {% else %} {% endfor %}
Actions
{{ t.kind }} {{ t.token_prefix }} {%- if t.kind == 'admin' -%}role: {{ t.role|default('—') }} {%- elseif t.kind == 'reporter' -%}reporter #{{ t.reporter_id }} {%- elseif t.kind == 'consumer' -%}consumer #{{ t.consumer_id }} {%- else -%}—{%- endif -%} {%- if t.user_label -%} {{ t.user_label }} {%- elseif t.user_id -%} user #{{ t.user_id }} {%- else -%} {%- endif -%} {% if t.last_used_at %}{% else %}never{% endif %} {% if t.revoked_at %} revoked {% else %} active {% endif %} {% if not t.revoked_at %} {% include 'partials/confirm_form.twig' with { action: '/app/tokens/' ~ t.id ~ '/delete', label: 'Revoke', description: 'Revoke this token immediately. Clients using it will start getting 401.', } only %} {% else %} {% include 'partials/confirm_form.twig' with { action: '/app/tokens/' ~ t.id ~ '/purge', label: 'Remove', description: 'Permanently delete this revoked token row. The audit log entry referring to its prefix will remain.', } only %} {% endif %}
No tokens.
{% if just_created %}

Copy this token now

This is the only time you'll see the raw token. Refreshing this page or closing the dialog discards it permanently. If you lose it, revoke it and issue a new one.

{% endif %} {% endblock %}