From 373393a30924325c058e36ba3dc19ed7c7abbe28 Mon Sep 17 00:00:00 2001 From: Chris Johnston Date: Fri, 30 Nov 2018 16:56:10 -0800 Subject: [PATCH] Add hint to user to check that token is not an oauth client secret --- src/Discord.Net.Core/Utils/TokenUtils.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net.Core/Utils/TokenUtils.cs b/src/Discord.Net.Core/Utils/TokenUtils.cs index f57a3ccac..f76bd24d8 100644 --- a/src/Discord.Net.Core/Utils/TokenUtils.cs +++ b/src/Discord.Net.Core/Utils/TokenUtils.cs @@ -85,10 +85,12 @@ namespace Discord // this value was determined by referencing examples in the discord documentation, and by comparing with // pre-existing tokens if (token.Length < MinBotTokenLength) - throw new ArgumentException(message: $"A Bot token must be at least {MinBotTokenLength} characters in length.", paramName: nameof(token)); + throw new ArgumentException(message: $"A Bot token must be at least {MinBotTokenLength} characters in length. " + + "Ensure that the Bot Token provided is not an OAuth client secret.", paramName: nameof(token)); // check the validity of the bot token by decoding the ulong userid from the jwt if (!CheckBotTokenValidity(token)) - throw new ArgumentException(message: "The Bot token was invalid.", paramName: nameof(token)); + throw new ArgumentException(message: "The Bot token was invalid. " + + "Ensure that the Bot Token provided is not an OAuth client secret.", paramName: nameof(token)); break; default: // All unrecognized TokenTypes (including User tokens) are considered to be invalid.