Handles authorization to the MySkoda API.

Authorization

Bases: ABC

Class that holds Authorization information and authorization state of the session.

app_prefix property

Calculate the app prefix.

base_url abstractmethod property

The base URL used for all API requests after authorization.

Must be implemented by the per-brand subclass.

client_id abstractmethod property

The client ID used for this authorization.

Must be implemented by the per-brand subclass.

redirect_uri abstractmethod property

The redirect URI used for this authorization.

Must be implemented by the per-brand subclass.

authorize(email, password) async

Authorize on the VW IDK servers.

authorize_refresh_token(refresh_token) async

Authorize by exchanging an existing OpenID refresh token.

This bypasses the username/password flow and initializes idk_session by calling the refresh endpoint with the provided refresh token.

get_access_token() async

Get the access token.

Use this method instead of using access_token directly. It will automatically check if the JWT token is about to expire and refresh it using the refresh_token.

get_refresh_token() async

Get the refresh token.

Use this method instead of using refresh_token directly. In future releases it will check if the JWT token is about to expire and refresh it.

is_refresh_token_expired(refresh_token=None)

Check whether the refresh token is expired.

is_token_expired()

Check whether the login token is expired.

refresh_token() async

Refresh the authorization token.

This will consume the refresh_token and exchange it for a new set of tokens.

AuthorizationError

Bases: Exception

Error to indicate that something unexpected happened during authorization.

AuthorizationFailedError

Bases: Exception

Failed to authorize.

BrandError

Bases: Exception

No valid brand configuration found.

CSRFError

Bases: Exception

Failed to parse the CSRF information from the website.

IDKSession dataclass

Bases: DataClassORJSONMixin

Stores the JWT tokens relevant for a session at the IDK server.

Can be used to authorized and refresh the authorization token.

InvalidStatusError

Bases: Exception

An invalid HTTP status code was received.

MarketingConsentError

Bases: Exception

Redirect to Marketing Consent encountered.

NotAuthorizedError

Bases: Exception

Not authorized.

Did you forget to call Authorization.authorize()?

TermsAndConditionsError

Bases: Exception

Redirect to Terms and Conditions was encountered.

TokenExpiredError

Bases: Exception

Presented token has expired.