tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
DiscordOAuthValidator.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.Extensions.Logging;
4
8
10{
15 {
17 public override OAuthProvider Provider => OAuthProvider.Discord;
18
20 protected override Uri TokenUrl => new("https://discord.com/api/oauth2/token");
21
23 protected override Uri UserInformationUrl => new("https://discord.com/api/users/@me");
24
33 ILogger<DiscordOAuthValidator> logger,
34 OAuthConfiguration oAuthConfiguration)
35 : base(httpClientFactory, logger, oAuthConfiguration)
36 {
37 }
38
40 protected override OAuthTokenRequest CreateTokenRequest(string code) => new(OAuthConfiguration, code, "identify");
41
43 protected override string DecodeTokenPayload(dynamic responseJson) => responseJson.access_token;
44
46 protected override string DecodeUserInformationPayload(dynamic responseJson) => responseJson.id;
47 }
48}
override OAuthProvider Provider
The OAuthProvider this validator is for.
override string DecodeTokenPayload(dynamic responseJson)
override string DecodeUserInformationPayload(dynamic responseJson)
DiscordOAuthValidator(IAbstractHttpClientFactory httpClientFactory, ILogger< DiscordOAuthValidator > logger, OAuthConfiguration oAuthConfiguration)
Initializes a new instance of the DiscordOAuthValidator class.
override OAuthTokenRequest CreateTokenRequest(string code)
OAuthConfiguration OAuthConfiguration
The OAuthConfiguration for the GenericOAuthValidator.
readonly IAbstractHttpClientFactory httpClientFactory
The IHttpClientFactory for the GenericOAuthValidator.
OAuthProvider
List of OAuth providers supported by TGS.