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 AuthInterceptor that injects the current access token from AuthBloc.
AuthBlocIdentityProvider
Bridges AuthBloc to juice_network's AuthIdentityProvider.
AuthBlocRefreshInterceptor
A RefreshTokenInterceptor wired to drive AuthBloc's refresh on 401.
AuthBlocRefreshStrategy
Drives AuthBloc's token refresh and resolves when it completes.