Table of Contents

Class OAuth2WebConfiguration

Namespace
DisCatSharp.Extensions.OAuth2Web
Assembly
DisCatSharp.Extensions.OAuth2Web.dll

Represents a configuration for OAuth2WebExtension.

public sealed class OAuth2WebConfiguration
Inheritance
OAuth2WebConfiguration
Inherited Members

Constructors

OAuth2WebConfiguration()

Creates a new instance of OAuth2WebConfiguration.

OAuth2WebConfiguration(OAuth2WebConfiguration)

Creates a new instance of OAuth2WebConfiguration, copying the properties of another configuration.

OAuth2WebConfiguration(IServiceProvider)

Initializes a new instance of the OAuth2WebConfiguration class.

Properties

ClientId

Sets the client id for the OAuth2 client.

ClientSecret

Sets the client secret for the OAuth2 client.

HtmlOutputException

This will show when any exception occured during the OAuth2 flow, instead of json output.

HtmlOutputInvalidState

This will show when the state parameter is invalid during the OAuth2 flow, instead of json output.

HtmlOutputSecurityException

This will show when SecureStates is active and the state has a mismatch during the OAuth2 flow, instead of json output.

HtmlOutputSuccess

This will show when the OAuth2 flow was successfully completed, instead of json output.

ListenAll

Sets whether to listen on *:StartPort instead of 127.0.0.1:StartPort.

Defaults to false.

LogTimestampFormat

Allows you to overwrite the time format used by the internal debug logger.

Only applicable when LoggerFactory is set left at default value. Defaults to ISO 8601-like format.

MinimumLogLevel

Sets the minimum logging level for messages.

Defaults to Information.

Proxy

Sets the proxy to use for HTTP connections to Discord.

Defaults to null.

ProxyTargetIpOrHost

Sets the ip address the proxy will target.

Will be 127.0.0.1 if ListenAll is false.

RedirectUri

Sets the redirect uri.

Must be http(s)://(sub).domain.tld/oauth/.

Must end on /.

If used in sharding, the redirect uri internally appends ShardId

Example: Sharded redirect uri:
<p>
    Shard 1 will have the uri
    <code>http://<xref href="DisCatSharp.Extensions.OAuth2Web.OAuth2WebConfiguration.ProxyTargetIpOrHost?text=Host" data-throw-if-not-resolved="false"></xref>:<xref href="DisCatSharp.Extensions.OAuth2Web.OAuth2WebConfiguration.StartPort?text=StartPort" data-throw-if-not-resolved="false"></xref>/oauth/s0/</code>.
</p>
<p>
    Shard 2 will have the uri
    <code>http://<xref href="DisCatSharp.Extensions.OAuth2Web.OAuth2WebConfiguration.ProxyTargetIpOrHost?text=Host" data-throw-if-not-resolved="false"></xref>:<xref href="DisCatSharp.Extensions.OAuth2Web.OAuth2WebConfiguration.StartPort?text=StartPort%2b1" data-throw-if-not-resolved="false"></xref>/oauth/s1/</code>.
</p>
SecureStates

Whether GenerateSecureState(ulong) and ReadSecureState(string) will be used.

Defaults to false.

ServiceProvider

Sets the service provider for this OAuth2Web instance.

Objects in this provider are used when instantiating command modules. This allows passing data around without resorting to static members.

Defaults to an empty service provider.

StartPort

Sets the port to listen on.

Defaults to 42069.

If used in sharding, the port will automatically be increased by 1 per shard.

Example: Sharding with 2 shards.
<p>Shard 0 will listen on <code>42069</code>.</p>
<p>Shard 1 will listen on <code>42070</code></p>
UseHtmlOutput

Sets whether to use html output instead of json output for the OAuth2 flow.