Skip to content

Class tigrbl_auth.rfc.rfc8693.TokenExchangeResponse

tigrbl_auth.rfc.rfc8693.TokenExchangeResponse

TokenExchangeResponse(
    access_token,
    token_type="Bearer",
    *,
    expires_in=None,
    refresh_token=None,
    scope=None,
    issued_token_type=None,
)

Represents a token exchange response per RFC 8693.

Initialize a token exchange response.

PARAMETER DESCRIPTION
access_token

The issued access token

TYPE: str

token_type

Token type (typically "Bearer")

TYPE: str DEFAULT: 'Bearer'

expires_in

Token lifetime in seconds

TYPE: Optional[int] DEFAULT: None

refresh_token

Optional refresh token

TYPE: Optional[str] DEFAULT: None

scope

Granted scope

TYPE: Optional[str] DEFAULT: None

issued_token_type

Type of the issued token

TYPE: Optional[str] DEFAULT: None

Source code in tigrbl_auth/rfc/rfc8693.py
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
def __init__(
    self,
    access_token: str,
    token_type: str = "Bearer",
    *,
    expires_in: Optional[int] = None,
    refresh_token: Optional[str] = None,
    scope: Optional[str] = None,
    issued_token_type: Optional[str] = None,
):
    """Initialize a token exchange response.

    Args:
        access_token: The issued access token
        token_type: Token type (typically "Bearer")
        expires_in: Token lifetime in seconds
        refresh_token: Optional refresh token
        scope: Granted scope
        issued_token_type: Type of the issued token
    """
    self.access_token = access_token
    self.token_type = token_type
    self.expires_in = expires_in
    self.refresh_token = refresh_token
    self.scope = scope
    self.issued_token_type = issued_token_type

access_token instance-attribute

access_token = access_token

token_type instance-attribute

token_type = token_type

expires_in instance-attribute

expires_in = expires_in

refresh_token instance-attribute

refresh_token = refresh_token

scope instance-attribute

scope = scope

issued_token_type instance-attribute

issued_token_type = issued_token_type

to_dict

to_dict()

Convert response to dictionary for JSON serialization.

Source code in tigrbl_auth/rfc/rfc8693.py
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
def to_dict(self) -> Dict[str, Any]:
    """Convert response to dictionary for JSON serialization."""
    result = {
        "access_token": self.access_token,
        "token_type": self.token_type,
    }

    if self.expires_in is not None:
        result["expires_in"] = self.expires_in
    if self.refresh_token:
        result["refresh_token"] = self.refresh_token
    if self.scope:
        result["scope"] = self.scope
    if self.issued_token_type:
        result["issued_token_type"] = self.issued_token_type

    return result