https://github.com/iniakunhuda/flutter_auth_riverpod_strapi
Simple Authentication Login with Riverpod Flutter + Strapi API
https://github.com/iniakunhuda/flutter_auth_riverpod_strapi
dart flutter flutter-riverpod riverpod
Last synced: about 1 year ago
JSON representation
Simple Authentication Login with Riverpod Flutter + Strapi API
- Host: GitHub
- URL: https://github.com/iniakunhuda/flutter_auth_riverpod_strapi
- Owner: iniakunhuda
- Created: 2023-04-02T05:25:22.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-02T05:53:04.000Z (about 3 years ago)
- Last Synced: 2025-04-11T00:14:12.116Z (about 1 year ago)
- Topics: dart, flutter, flutter-riverpod, riverpod
- Language: Dart
- Homepage:
- Size: 1.01 MB
- Stars: 12
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Flutter Simple Auth with Riverpod & Strapi
Flutter Flutter allows you to build beautiful native apps on iOS and Android Platforms from a single codebase. The main goal of this repository is to learn how to implement simple login authentication Riverpod (flutter state management) & Strapi (Rest API)
### Package
- RiverPod Hooks (https://riverpod.dev/)
- flutter_hooks (https://pub.dev/packages/flutter_hooks)
- Strapi API (https://strapi.io/)
- dio (https://pub.dev/packages/dio)
- dartz (https://pub.dev/packages/dartz)
- shared_preferences (https://pub.dev/packages/shared_preferences)
### Strapi Setup
Running in local / deploy to production

### Rest API
#### Happy Scenario
Body
```json
{
"identifier": "miftahulinc@gmail.com",
"password": "huda12345"
}
```
Response
```json
{
"jwt": "generated_jwt_token",
"user": {
"id": 1,
"username": "miftahulinc",
"email": "miftahulinc@gmail.com",
"provider": "local",
"confirmed": true,
"blocked": false,
"createdAt": "2023-04-02T02:46:58.297Z",
"updatedAt": "2023-04-02T02:47:39.939Z"
}
}
```
#### Bad Scenario
Body
```json
{
"identifier": "miftahulinc@gmail.com",
"password": "huda123453"
}
```
Response
```json
{
"data": null,
"error": {
"status": 400,
"name": "ValidationError",
"message": "Invalid identifier or password",
"details": {}
}
}
```