Question: Is it possible to achive authentication with email and password in flutter without using firebase? I have searched around Stackoverflow and internet in general and found nothing about this.
I am creating a simple authentication class this is what I have done at the moment:

```
class User {
  bool isAuthenticated = false;
  late String userid;
  late String username;
  late String email;
  late DateTime expireDate; // this variable is used to make the user re-authenticate when today is expireDate

  User(bool isAuthenticated, String userid, String username, String email) {
    this.isAuthenticated = isAuthenticated;
    this.userid = userid;
    this.username = username;
    this.email = email;
    this.expireDate = new DateTime.now().add(new Duration(days: 30));
  }
}

class Authentication {
  Future<User> signin(String email, String password) {}

  void signup(String username, String email, String password) {}
}

```

EDIT #1: I know how to setup a cookie/token based authentication server I have my own repos on that topic: [cookie authentication](https://github.com/datteroandrea/cookieauth), [token authentication](https://github.com/datteroandrea/jwtauth) but I don't know how to handle the tokens/cookies in flutter.

Answer: 
You can use Nodejs & express to create your own API and MongoDB or any other DB to act as a persistent DB. I am attaching my github repo link which has minimum code required to setup a email/password auth in mongodb

[Github](https://github.com/AshutoshPatole/backends)
EDIT :

I have little to no idea about sessions but for tokens there are packages in pub.dev which lets you decode the tokens. [jwt-decoder](https://pub.dev/packages/jwt_decoder).
You can check the expiry time of the token using this package and for storing them you can use [secure\_storage](https://pub.dev/packages/flutter_secure_storage)

I had a look at your token authentication repo. I would suggest you to verify the token when you get them and not just blindly trust them.
Yes it is Totally possible to create Authentication without Firebase, but it becomes a-lot more difficult and there are multiple solutions.

What firebase provides:
-----------------------

1. Server space with no down time
2. Complete set of Api's including authentication with various methods
3. Strong security(built by google)
4. Ease of use and setup with great documentation

The reason I bring these up is cause the alternative ur looking for is very difficult for a programer who's relatively new and can feel like you are building multiple applications at a time. It's definitely a learning curve. Also I'm assuming u don't just want local authentication cause thats kinda pointless.

Creating ur own backend involves:
---------------------------------

1. Setting up a server(usually ubuntu)(and either on a raspi or a host like amazon, digital ocean, etc)
2. Setting up a database with tables(mysql, sql, mongoDB)
3. Creating communication API's (php, Node.js)

So here's what i'd recommend for getting into backend dev,
use LAMP architecture : Linux, Apache, MySQL, PHP

Setting up Lamp isn't too hard heres a link i followed:

<https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04>

After u set up ur back end, then u have to create api calls from flutter.
The call (if u created an auth.php where people can login) would look something like:

```
http://ip:8080/auth.php?email="example@gmail.com"&pass="123456"

```

I understand why you feel like you didn't find solutions, i was there too but there are tons,LAMP is one of the more easier ones. If u are still interested i'd recommend checking out System Design courses.