mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-13 14:44:24 -04:00
Change how user token is sent in requests
This commit is contained in:
parent
0d816cee5d
commit
dd9da4831e
1 changed files with 4 additions and 7 deletions
|
@ -32,13 +32,10 @@ namespace DiscordChatExporter.Core.Services
|
||||||
const string apiRoot = "https://discordapp.com/api/v6";
|
const string apiRoot = "https://discordapp.com/api/v6";
|
||||||
using (var request = new HttpRequestMessage(HttpMethod.Get, $"{apiRoot}/{resource}/{endpoint}"))
|
using (var request = new HttpRequestMessage(HttpMethod.Get, $"{apiRoot}/{resource}/{endpoint}"))
|
||||||
{
|
{
|
||||||
// Add url parameter for the user token
|
// Set authorization header
|
||||||
if (token.Type == AuthTokenType.User)
|
request.Headers.Authorization = token.Type == AuthTokenType.User
|
||||||
request.RequestUri = request.RequestUri.SetQueryParameter("token", token.Value);
|
? new AuthenticationHeaderValue(token.Value)
|
||||||
|
: new AuthenticationHeaderValue("Bot", token.Value);
|
||||||
// Add header for the bot token
|
|
||||||
if (token.Type == AuthTokenType.Bot)
|
|
||||||
request.Headers.Authorization = new AuthenticationHeaderValue("Bot", token.Value);
|
|
||||||
|
|
||||||
// Add parameters
|
// Add parameters
|
||||||
foreach (var parameter in parameters)
|
foreach (var parameter in parameters)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue