Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dariowskii/refresh-token-interceptor
A Refresh Token Interceptor implementation example, also with Riverpod!
https://github.com/dariowskii/refresh-token-interceptor
flutter jwt refresh-token riverpod token
Last synced: 3 months ago
JSON representation
A Refresh Token Interceptor implementation example, also with Riverpod!
- Host: GitHub
- URL: https://github.com/dariowskii/refresh-token-interceptor
- Owner: dariowskii
- Created: 2024-05-21T19:19:03.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-06-01T15:57:48.000Z (8 months ago)
- Last Synced: 2024-10-07T19:19:25.315Z (3 months ago)
- Topics: flutter, jwt, refresh-token, riverpod, token
- Language: Dart
- Homepage: https://medium.com/@dariovarrialeapps/how-to-create-a-refresh-token-interceptor-in-flutter-with-dio-64a3ab0be6fa
- Size: 3.25 MB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RefreshTokenInterceptor
A Flutter package that provides an interceptor for Dio that automatically refreshes the token when it expires.
In this example there are two implementations of the interceptor, a simple one and one with Riverpod.
This example is related to my article on Medium: [How to create a RefreshTokenInterceptor in Flutter (with Dio)](https://medium.com/@dariovarrialeapps/how-to-create-a-refresh-token-interceptor-in-flutter-with-dio-64a3ab0be6fa)
![demo image](./assets/demo.gif)
## Getting Started
First, you need to install the dependencies:
```bash
flutter pub get
```Then, choose a device and run the project:
```bash
flutter run
```---
Inside the `main.dart` file, you can see that you can choose between the two implementations of the interceptor.
```dart
void main() {
// runApp(const MyApp()); -> Simple implementation
runApp( // Riverpod implementation
const ProviderScope(
child: MyAppRiverpod(),
),
);
}
```By default, the `MyAppRiverpod` is being used, but you can change it to `MyApp` to use the simple implementation.
Made with ❤️ by [Dario Varriale](https://www.linkedin.com/in/dario-varriale/)