Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tolbaax/flutter_refresh_token

Repository files navigation

Flutter Refresh Token Management with Dio

This repository provides a solution for handling Access Token expiration in Flutter apps by leveraging Refresh Tokens. The solution uses the Dio HTTP client and FlutterSecureStorage for secure token storage and management. The implementation ensures that users can continue their sessions without needing to log in again, even after the access token expires.

Features

  • Automatic Token Management: Automatically refreshes the access token when it expires.
  • Secure Token Storage: Uses FlutterSecureStorage to store tokens securely.
  • Interceptor Integration: Dio interceptors handle token injection and refresh seamlessly.
  • Clean Architecture: Clear separation of concerns for better maintainability and scalability.
  • Error Handling: Handles 401 Unauthorized errors by refreshing the token and retrying the request.

Prerequisites

  • Flutter 3.0 or higher
  • Dio 5.0 or higher
  • FlutterSecureStorage

Installation

  1. Add dependencies to your pubspec.yaml file:
dependencies:
  dio: ^5.0.0
  flutter_secure_storage: ^5.0.0

About

Flutter Refresh Token Management with Dio

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published