Skip to content

Admin generates invite token for self-registration #107

Open

Description

@bitbiter-dev

Context

Issue #2.18 adds the Invite entity and gates POST /auth/register with invite-token validation. This issue adds the admin endpoint to actually generate tokens so the self-registration flow can be used end-to-end.

This is post-v1.0. Admin-creates-user (POST /api/v1/users, issue #99) covers all provisioning for v1.0. This endpoint is only needed when a UI-driven self-registration flow is introduced.

Endpoint

POST /api/v1/users/invites

Caller must hold the IsAdmin claim.

Behaviour

  • Generates a cryptographically random plain token: Convert.ToBase64String(RandomNumberGenerator.GetBytes(32))
  • Stores the SHA-256 hash in the Invites table (entity added by Set up solution structure #2.18)
  • Sets CreatedAt = now, ExpiresAt = now + configured days (default 7 days, configurable)
  • Returns 201 Created with { "token": "...", "expiresAt": "..." } — plain token returned once only
  • The admin sends the token to the invitee out-of-band

Notes

Requires #2.18 to be merged first (provides Invite entity + IInviteRepository).

Activity

  1. changed the title [-]2.20 Admin generates invite token for self-registration[/-] [+]Admin generates invite token for self-registration[/+] on May 12, 2026
  2. added
    deferredConsciously skipped — not needed for v1.0 but important to address later
    on May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    deferredConsciously skipped — not needed for v1.0 but important to address laterenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions