Discord Social SDK
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
discordpp::AuthorizationArgs Class Reference

Detailed Description

Arguments to the Client::Authorize function.

Public Member Functions

 AuthorizationArgs (AuthorizationArgs &&other) noexcept
 Move constructor for AuthorizationArgs.
 
AuthorizationArgsoperator= (AuthorizationArgs &&other) noexcept
 Move assignment operator for AuthorizationArgs.
 
 operator bool () const
 Returns true if the instance contains a valid object.
 
 AuthorizationArgs (const AuthorizationArgs &arg0)
 Copy constructor for AuthorizationArgs.
 
AuthorizationArgsoperator= (const AuthorizationArgs &arg0)
 Copy assignment operator for AuthorizationArgs.
 
uint64_t ClientId () const
 Optional. The Discord application ID for your game. Defaults to the value set by Client::SetApplicationId.
 
void SetClientId (uint64_t ClientId)
 Setter for AuthorizationArgs::ClientId.
 
std::string Scopes () const
 Scopes is a space separated string of the oauth scopes your game is requesting.
 
void SetScopes (std::string Scopes)
 Setter for AuthorizationArgs::Scopes.
 
std::optional< std::string > State () const
 See https://discord.com/developers/docs/topics/oauth2#state-and-security for details on this field.
 
void SetState (std::optional< std::string > State)
 Setter for AuthorizationArgs::State.
 
std::optional< std::string > Nonce () const
 The nonce field is generally only useful for backend integrations using ID tokens.
 
void SetNonce (std::optional< std::string > Nonce)
 Setter for AuthorizationArgs::Nonce.
 
std::optional< discordpp::AuthorizationCodeChallengeCodeChallenge () const
 If using the Client::GetToken flow, you will need to generate a code challenge and verifier.
 
void SetCodeChallenge (std::optional< discordpp::AuthorizationCodeChallenge > CodeChallenge)
 Setter for AuthorizationArgs::CodeChallenge.
 

Static Public Attributes

static const AuthorizationArgs nullobj
 Uninitialized instance of AuthorizationArgs.
 

Constructor & Destructor Documentation

◆ AuthorizationArgs() [1/2]

discordpp::AuthorizationArgs::AuthorizationArgs ( AuthorizationArgs && other)
noexcept

Move constructor for AuthorizationArgs.

◆ AuthorizationArgs() [2/2]

discordpp::AuthorizationArgs::AuthorizationArgs ( const AuthorizationArgs & arg0)

Copy constructor for AuthorizationArgs.

Member Function Documentation

◆ ClientId()

uint64_t discordpp::AuthorizationArgs::ClientId ( ) const

Optional. The Discord application ID for your game. Defaults to the value set by Client::SetApplicationId.

◆ CodeChallenge()

std::optional< discordpp::AuthorizationCodeChallenge > discordpp::AuthorizationArgs::CodeChallenge ( ) const

If using the Client::GetToken flow, you will need to generate a code challenge and verifier.

Use Client::CreateAuthorizationCodeVerifier to generate these values and pass the challenge property here.

◆ Nonce()

std::optional< std::string > discordpp::AuthorizationArgs::Nonce ( ) const

The nonce field is generally only useful for backend integrations using ID tokens.

For more information, see: https://openid.net/specs/openid-connect-core-1_0.html#rfc.section.2~nonce:~:text=auth_time%20response%20parameter.)-,nonce,-String%20value%20used

◆ operator bool()

discordpp::AuthorizationArgs::operator bool ( ) const
inline

Returns true if the instance contains a valid object.

◆ operator=() [1/2]

AuthorizationArgs & discordpp::AuthorizationArgs::operator= ( AuthorizationArgs && other)
noexcept

Move assignment operator for AuthorizationArgs.

◆ operator=() [2/2]

AuthorizationArgs & discordpp::AuthorizationArgs::operator= ( const AuthorizationArgs & arg0)

Copy assignment operator for AuthorizationArgs.

◆ Scopes()

std::string discordpp::AuthorizationArgs::Scopes ( ) const

Scopes is a space separated string of the oauth scopes your game is requesting.

Most games should just pass in Client::GetDefaultCommunicationScopes or Client::GetDefaultPresenceScopes which will include these scopes, respectively: openid sdk.social_layer or openid sdk.social_layer_presence

sdk.social_layer and sdk.social_layer_presence automatically expand to include all the necessary scopes for the integration.

You can pass in additional scopes if you need to, but as a general rule you should only request the scopes you actually need, and the user will need to grant access to those additional scopes as well.

◆ SetClientId()

void discordpp::AuthorizationArgs::SetClientId ( uint64_t ClientId)

◆ SetCodeChallenge()

void discordpp::AuthorizationArgs::SetCodeChallenge ( std::optional< discordpp::AuthorizationCodeChallenge > CodeChallenge)

◆ SetNonce()

void discordpp::AuthorizationArgs::SetNonce ( std::optional< std::string > Nonce)

◆ SetScopes()

void discordpp::AuthorizationArgs::SetScopes ( std::string Scopes)

◆ SetState()

void discordpp::AuthorizationArgs::SetState ( std::optional< std::string > State)

◆ State()

std::optional< std::string > discordpp::AuthorizationArgs::State ( ) const

See https://discord.com/developers/docs/topics/oauth2#state-and-security for details on this field.

We recommend leaving this unset, and the SDK will automatically generate a secure random value for you.

Member Data Documentation

◆ nullobj

const AuthorizationArgs discordpp::AuthorizationArgs::nullobj
static

Uninitialized instance of AuthorizationArgs.