Cookies, Tokens, or JWTs? The ASP.NET Core Identity Dilemma

Disabling /register is possible;

app.MapGroup("/account").MapIdentityApi<User>();

app.UseAuthorization();

app.Use(async (context, next) =>
{
#if DEBUG
    await next.Invoke();
#else
    //if we are in prod then return 404 for register endpoint
    if (context.Request.Path.ToString().StartsWith("/account/register"))
    {
        context.Response.StatusCode = 404;
        await context.Response.CompleteAsync();
    }
    else
    {
        await next.Invoke();
    }
#endif
});