AuthInterceptor class

Interceptor for handling authentication tokens

Implemented types

Constructors

AuthInterceptor({required Future<String?> tokenProvider(), String tokenPrefix = 'Bearer', String headerName = 'Authorization'})
Creates an auth interceptor with a token provider

Properties

hashCode int
The hash code for this object.
no setterinherited
headerName String
Header name for the token (default: "Authorization")
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tokenPrefix String
Prefix for the token (default: "Bearer")
final
tokenProvider Future<String?> Function()
Function to provide the authentication token
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onRequest(Uri url, HttpMethod method, Map<String, String> headers, dynamic body) Future<void>
Called before a request is sent
override
onResponse(Response response) Future<void>
Called after a response is received
override
toString() String
A string representation of this object.
inherited

Operators

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