Class DiscordToken


  • public class DiscordToken
    extends Object
    Represents a token, retrieved from discord API. Holds access token, which at some point, expires, and a refresh token to refresh the access token.
    • Constructor Detail

      • DiscordToken

        public DiscordToken​(String accessToken,
                            long expiresIn,
                            String refreshToken,
                            String scope,
                            String tokenType)
    • Method Detail

      • getAccessToken

        @Nonnull
        public String getAccessToken()
        Returns the access token.
        Returns:
        access token
      • getTokenType

        @Nonnull
        public String getTokenType()
        Returns the type of the discord token. This may be null if discord api didn't specify it.
        Returns:
        token type
      • getExpiresIn

        public long getExpiresIn()
        Returns whenever the access token expires. This may be 0 if discord api didn't specify it.
        Returns:
        expires in
      • getRefreshToken

        @Nonnull
        public String getRefreshToken()
        Returns the refresh token, used to refresh the access token.
        Returns:
        refresh token
      • getScope

        @Nonnull
        public String getScope()
        Returns the scopes we're allowed to get information for.
        Returns:
        scope
      • parseScopes

        @Nonnull
        public String[] parseScopes()
        Parses the scopes to a json array, for easily iterating thru them.
        Returns:
        scope array