fresh_dio 0.5.1 copy "fresh_dio: ^0.5.1" to clipboard
fresh_dio: ^0.5.1 copied to clipboard

An http interceptor for token refresh. Fresh is built on top of package:dio and manages authentication tokens transparently.

fresh_dio 🍋 #

Pub build coverage License: MIT


A dio interceptor for built-in token refresh. Built to be used with fresh.

Overview #

fresh_dio is a dio interceptor which attempts to simplify custom API authentication by integrating token refresh and caching transparently. fresh_dio is flexible and is intended to support custom token refresh mechanisms.

Usage #

dio.interceptors.add(
  Fresh.oAuth2(
    tokenStorage: InMemoryTokenStorage<OAuth2Token>(),
    refreshToken: (token, client) {
      // Perform refresh and return new token
    },
  ),
);

Example #

See the example for a complete sample application using fresh_dio which integrates with jsonplaceholder.

166
likes
160
points
14.6k
downloads

Documentation

API reference

Publisher

verified publisherfelangel.dev

Weekly Downloads

An http interceptor for token refresh. Fresh is built on top of package:dio and manages authentication tokens transparently.

Repository (GitHub)
View/report issues

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

dio, fresh

More

Packages that depend on fresh_dio