2024-06-10 16:25:49 +02:00
|
|
|
using Foxnouns.Backend.Database;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
namespace Foxnouns.Backend.Controllers.Authentication;
|
|
|
|
|
|
|
|
[Route("/api/v2/auth/discord")]
|
|
|
|
public class DiscordAuthController(Config config, DatabaseContext db) : ApiControllerBase
|
|
|
|
{
|
2024-06-12 03:47:20 +02:00
|
|
|
private void CheckRequirements()
|
2024-06-10 16:25:49 +02:00
|
|
|
{
|
2024-06-12 03:47:20 +02:00
|
|
|
if (config.DiscordAuth.ClientId == null || config.DiscordAuth.ClientSecret == null)
|
|
|
|
{
|
|
|
|
throw new ApiError.BadRequest("Discord authentication is not enabled on this instance.");
|
|
|
|
}
|
2024-06-10 16:25:49 +02:00
|
|
|
}
|
|
|
|
}
|