Skip to main content

dio_auth_kit 0.1.0 copy "dio_auth_kit: ^0.1.0" to clipboard
dio_auth_kit: ^0.1.0 copied to clipboard

Bearer and JWT authentication for dio and retrofit: header injection, single-flight token refresh with retry, and per-endpoint auth annotations.

0.1.0 #

  • AuthInterceptor: bearer header injection, single-flight token refresh, retry of the failed request, proactive refresh before JWT expiry.
  • Retrofit-compatible annotations: @Authenticated, @OptionalAuth, @NoAuth, @SkipRefresh, @AllowRefresh.
  • Scopes: settings resolve from the method, then the client, then the interceptor.
  • Client scope: @RestApi(headers: AuthScope.none) (retrofit >= 4.8) or AuthScope.dio(dio, mode: ...) on any retrofit version. The marker headers are removed before the request is sent.
  • Global scope: AuthInterceptor(defaultMode:, defaultSkipRefresh:).
  • Error rules decide refresh, end of session or pass-through from the backend's error: @RefreshOn, @ExpireOn and @PassThroughOn per method, AuthScope status headers per client, and AuthErrorPolicy globally, which matches on status, JSON body fields, body text, response headers or any predicate.
  • TokenStorage interface with InMemoryTokenStorage and CachedTokenStorage.
  • AuthEvent stream: TokenRefreshed, RefreshFailed, SessionExpired.
2
likes
160
points
70
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Bearer and JWT authentication for dio and retrofit: header injection, single-flight token refresh with retry, and per-endpoint auth annotations.

Repository (GitHub)
View/report issues

Topics

#dio #retrofit #jwt #authentication #http

License

MIT (license)

Dependencies

dio, meta, retrofit

More

Packages that depend on dio_auth_kit