From 62c5c3865a77cc3becd3c1e8e36e91637741e15d Mon Sep 17 00:00:00 2001 From: spiral Date: Thu, 16 Jun 2022 17:51:53 -0400 Subject: [PATCH] fix(api): generate token if needed in discord oauth response --- PluralKit.API/Controllers/PrivateController.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PluralKit.API/Controllers/PrivateController.cs b/PluralKit.API/Controllers/PrivateController.cs index 1043e5a4..6e0fc25b 100644 --- a/PluralKit.API/Controllers/PrivateController.cs +++ b/PluralKit.API/Controllers/PrivateController.cs @@ -135,6 +135,9 @@ public class PrivateController: PKControllerBase // guilds.Select(g => new HashEntry(g.Value("id"), true)).ToArray() // ); + if (system.Token == null) + system = await _repo.UpdateSystem(system.Id, new SystemPatch { Token = StringUtils.GenerateToken() }); + var o = new JObject(); o.Add("system", system.ToJson(LookupContext.ByOwner));