Skip to content

SashaKryzh/flutter_chopper_authentication_example

Repository files navigation

Flutter Chopper authentication example with retry on 401 Unauthorized

Flutter Chopper authentication example with retry on 401 Unauthorized

How to add an HTTP Authorization header to the Chopper requests using interceptor and how to refresh token and retry requests in case of 401 Unauthorized response.

⭐️ Article on Medium

Files navigation

  • main.dart - basic UI.
  • chopper.dart - Chopper client, auth header interceptor, and Authenticator for retry on 401 (Unauthorized).
  • auth_repository.dart - repository with an access token and fake remote server to emulate the access token invalidation.

Flutter version: 3.13.0