Messages

The following section documents everything related to OAuth2.

Models

OAuth2ScopeReasoning

Attributes
class stoat.OAuth2ScopeReasoning(*, allow, deny)[source]

Represents reasoning why a certain OAuth2 scope is being requested.

Added in version 1.2.

allow

Type:

str

deny

Type:

str

Parameters:
  • allow (str) –

  • deny (str) –

PossibleOAuth2Authorization

Attributes
class stoat.PossibleOAuth2Authorization(*, bot, user, allowed_scopes)[source]

Represents a possible OAuth2 authorization.

Added in version 1.2.

bot

The bot.

Type:

PublicBot

user

The bot user.

Type:

User

allowed_scopes

A mapping of OAuth2 scopes to reasoning why would it be requested.

Type:

Dict[str, OAuth2ScopeReasoning]

OAuth2AccessToken

class stoat.OAuth2AccessToken(*, state, access_token, refresh_token, token_type, scopes)[source]

Represents result of exchanging OAuth2 code, or refreshing token.

Added in version 1.2.

state

State that controls this OAuth2 authorization.

Type:

State

access_token

The OAuth2 token.

Type:

str

refresh_token

The refresh token, used to retrieve new access tokens.

Type:

Optional[str]

token_type

The type of OAuth2 token.

Type:

str

scopes

The scopes that the OAuth2 token has.

Type:

str

await revoke(*, http_overrides=None)[source]

This function is a coroutine.

Revokes the OAuth2 token.

Parameters:

http_overrides (Optional[HTTPOverrideOptions]) – The HTTP request overrides.

Raises:
  • HTTPException – Possible values for type:

    Value

    Reason

    InvalidOperation

    The token was already revoked.

  • Unauthorized – Possible values for type:

    Value

    Reason

    NotAuthenticated

    The token was invalid.

  • NotFound – Possible values for type:

    Value

    Reason

    NotFound

    The OAuth2 authorization was deleted.

Returns:

The revoked OAuth2 authorization.

Return type:

OAuth2Authorization