BasicAuthInterceptor class

HTTP Basic authentication using a fixed username and password.

Inheritance

Constructors

BasicAuthInterceptor({required String username, required String password, void onAuthFailure()?})

Properties

hashCode int
The hash code for this object.
no setterinherited
onAuthFailure → void Function()?
Optional callback fired when the server signals the account is no longer valid (HTTP 401, or 403 with user_deactivated / account_deactivated / account_banned in the body). Consumers typically wire this to a global "force logout" handler.
final
password String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
username String
final

Methods

getAuthHeader() Future<String>
override
getToken() Future<String>
Return the full Basic <base64> header instead of stripping the prefix. The realtime WS handshake sends {type: auth, token: <getToken()>}; the server-side handler (e.g. CHT user_client_ws_handler:handle_auth/2) inspects the token's prefix to choose the auth scheme. Without the Basic prefix the token would be misclassified as a bearer JWT, fail JWT decoding, and the connection would close with auth_error: invalid_token.
override
invalidateCache() → void
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError(DioException err, ErrorInterceptorHandler handler) Future<void>
Called when an exception was occurred during the request.
onRequest(RequestOptions options, RequestInterceptorHandler handler) Future<void>
Called when the request is about to be sent.
inherited
onResponse(Response response, ResponseInterceptorHandler handler) → void
Called when the response is about to be resolved.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited