juice_auth_network library
Integration glue between juice_auth and juice_network.
Wires an AuthBloc into a FetchBloc so authenticated requests, 401 token
refresh, and per-user cache isolation work without hand-written plumbing.
final dio = Dio();
final fetchBloc = FetchBloc(
storageBloc: storageBloc,
dio: dio,
authIdentityProvider: AuthBlocIdentityProvider(authBloc).call,
);
fetchBloc.send(InitializeFetchEvent(
config: FetchConfig(baseUrl: 'https://api.example.com'),
interceptors: [
AuthBlocAuthInterceptor(authBloc),
AuthBlocRefreshInterceptor(authBloc, dio: dio),
],
));
Classes
- AuthBlocAuthInterceptor
-
An
AuthInterceptorthat injects the current access token fromAuthBloc. - AuthBlocIdentityProvider
-
Bridges
AuthBloctojuice_network'sAuthIdentityProvider. - AuthBlocRefreshInterceptor
-
A
RefreshTokenInterceptorwired to driveAuthBloc's refresh on 401. - AuthBlocRefreshStrategy
-
Drives
AuthBloc's token refresh and resolves when it completes.