{"id":24013648,"url":"https://github.com/mahmoudelsayed7/auth-with-refresh-token","last_synced_at":"2026-05-16T18:02:13.190Z","repository":{"id":263703087,"uuid":"891083679","full_name":"MAHMOUDELSAYED7/Auth-with-Refresh-Token","owner":"MAHMOUDELSAYED7","description":"User authentication with login, signup, OTP verification, automatic token refresh, and secure storage using Dio HTTP client and Flutter Secure Storage.","archived":false,"fork":false,"pushed_at":"2024-11-24T00:18:18.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-30T13:00:03.184Z","etag":null,"topics":["access-token","api","api-client","api-rest","auth-helper","authentication","dio","dio-interceptor","flutter","flutter-apis-implementation","flutter-apps","flutter-package","interceptor","interceptor-http","pub-dev","refresh-access-token","refresh-token","secure-storage","token","tokens"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MAHMOUDELSAYED7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-19T17:40:21.000Z","updated_at":"2024-11-24T00:18:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"d290ce94-d3fc-4e8e-8880-4187e22e2473","html_url":"https://github.com/MAHMOUDELSAYED7/Auth-with-Refresh-Token","commit_stats":null,"previous_names":["mahmoudelsayed69/jwt-dio-interceptor","mahmoudelsayed7/auth-with-refresh-token"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MAHMOUDELSAYED7/Auth-with-Refresh-Token","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MAHMOUDELSAYED7%2FAuth-with-Refresh-Token","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MAHMOUDELSAYED7%2FAuth-with-Refresh-Token/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MAHMOUDELSAYED7%2FAuth-with-Refresh-Token/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MAHMOUDELSAYED7%2FAuth-with-Refresh-Token/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MAHMOUDELSAYED7","download_url":"https://codeload.github.com/MAHMOUDELSAYED7/Auth-with-Refresh-Token/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MAHMOUDELSAYED7%2FAuth-with-Refresh-Token/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278486612,"owners_count":25995006,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["access-token","api","api-client","api-rest","auth-helper","authentication","dio","dio-interceptor","flutter","flutter-apis-implementation","flutter-apps","flutter-package","interceptor","interceptor-http","pub-dev","refresh-access-token","refresh-token","secure-storage","token","tokens"],"created_at":"2025-01-08T06:56:16.651Z","updated_at":"2025-10-05T17:22:36.999Z","avatar_url":"https://github.com/MAHMOUDELSAYED7.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flutter Authentication with Refresh Token\n\n## Overview\nThis Flutter project demonstrates handling authentication processes such as login, signup, OTP verification, and automatic token refresh using the [Dio HTTP client](https://pub.dev/packages/dio), with secure storage management using [Flutter Secure Storage](https://pub.dev/packages/flutter_secure_storage).\n\n## Features\n- User Authentication (Login, Signup)\n- OTP Verification\n- Automatic Token Refresh using Interceptors\n- Secure Token Storage\n\n## Usage\n\n### Authentication\n- **Login**: Use `ApiService().login(email, password)` to authenticate users.\n- **Signup**: Use `ApiService().signUp(name, email, password)` to register new users.\n- **Verify OTP**: Use `ApiService().verifyOtp(email, otp)` for OTP verification.\n\n### Token Management\n- **Securely Store Tokens**: Use `SecureStorageManager.writeData('accessToken', token)` to store tokens securely.\n- **Read Tokens**: Use `SecureStorageManager.readData('accessToken')` to retrieve tokens securely.\n\n### Secure API Requests\nEnsure all API requests are authenticated using the access token retrieved from secure storage:\n```dart\nFuture\u003cResponse\u003e getProductByToken() async {\n  final token = await SecureStorageManager.readData('accessToken');\n  final response = await _dio.get('/product/1',\n      options: Options(headers: {'Authorization': 'Bearer $token'}));\n  return response;\n}\n```\n## Handling Token Expiry\n\nThe `RefreshTokenInterceptor` automatically handles token expiration by refreshing the token and retrying the original request seamlessly when encountering 401 or 403 errors.\n\nintain secure sessions across multiple services or APIs.\n\n\n## Contribution\n\nContributions to the project are welcome! Please fork the repository and submit a pull request with your features or fixes.\n\n## Issues\n\nIf you encounter any issues while using this project, please open an issue in the repository with a detailed description of the problem, steps to reproduce it, and the expected behavior. We appreciate your contributions to improving this project.\n\n## Contact\n\nFor any questions or feedback, please reach out via email: [mahmoudelsayed.dev@gmail.com](mahmoudelsayed.dev@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahmoudelsayed7%2Fauth-with-refresh-token","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahmoudelsayed7%2Fauth-with-refresh-token","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahmoudelsayed7%2Fauth-with-refresh-token/lists"}