OAuth2Token

public struct OAuth2Token
extension OAuth2Token: Equatable
extension OAuth2Token: Codable

A data container that holds all relevant output information that are common for an OAuth2 token across all grants.

  • The access token. Access tokens are credentials used to access protected resources. An access token is a string representing an authorization issued to the client. The string is usually opaque to the client.

    Declaration

    Swift

    public let accessToken: String
  • The type of the access token issued.

    Declaration

    Swift

    public let tokenType: String
  • A set of scopes that the server issued the client.

    Declaration

    Swift

    public let scopes: Set<String>
  • The token’s expiry date. Wrapped as Date or nil if none was provided by the server.

    Declaration

    Swift

    public let expiryDate: Date?
  • The refresh token. Carry the information necessary to get a new access token.

    Declaration

    Swift

    public let refreshToken: String?
  • Instantiates a token from token properties.

    Declaration

    Swift

    public init(accessToken: String, tokenType: String, expiryDate: Date? = nil, scopes: Set<String> = [], refreshToken: String? = nil)

    Parameters

    accessToken

    The access token. Access tokens are credentials used to access protected resources. An access token is a string representing an authorization issued to the client. The string is usually opaque to the client.

    tokenType

    The type of the access token issued.

    expiryDate

    The token’s expiry date. Wrapped as Date or nil if none was provided by the server.

    scopes

    A set of scopes that the server issued the client.

    refreshToken

    The refresh token. Carry the information necessary to get a new access token.

  • Declaration

    Swift

    public static func == (lhs: OAuth2Token, rhs: OAuth2Token) -> Bool
  • Declaration

    Swift

    public init(from decoder: Decoder) throws
  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws