AuthInterceptor class

Interceptor that automatically injects Authorization headers into requests.

Inheritance

Constructors

AuthInterceptor({String? initialToken, Future<String?> tokenProvider()?, String headerKey = 'Authorization', String headerPrefix = 'Bearer '})

Properties

hashCode → int
The hash code for this object.
no setterinherited
headerKey → String
final
headerPrefix → String
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tokenProvider → Future<String?> Function()?
final

Methods

clearToken() → void
Clears the stored explicit token.
getToken() → Future<String?>
Retrieves the active token from explicit storage or dynamic provider.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError(ApiError error) → Future<ApiError?>
Called when an HTTP or network error occurs.
inherited
onRequest(ApiRequest request) → Future<ApiRequest>
Called before the request is sent over the network.
override
onResponse(ApiResponse response) → Future<ApiResponse>
Called when a response is received from the server.
inherited
setToken(String token) → void
Sets an explicit authentication token.
toString() → String
A string representation of this object.
inherited

Operators

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