2022-02-06 09:13:24 +01:00
## Auth Web Microservice with Rust using Actix Web
2019-07-18 13:55:14 +02:00
2021-10-06 23:28:53 +02:00
### Flow of the event would look like this:
2018-12-09 16:55:36 +01:00
- Registers with email address ➡ Receive an 📨 with a link to verify
- Follow the link ➡ register with same email and a password
2019-07-18 13:55:14 +02:00
- Login with email and password ➡ Get verified and receive auth cookie
2018-12-09 16:55:36 +01:00
2021-10-06 23:28:53 +02:00
### Available Routes
- [GET / ](http://localhost:8080/ )
- [POST /api/invitation ](http://localhost:8080/api/invitation )
- [POST /api/invitation/:invitation_id ](http://localhost:8080/api/invitation/:invitation_id )
- [GET /api/auth ](http://localhost:8080/api/auth )
- [POST /api/auth ](http://localhost:8080/api/auth )
- [DELETE /api/auth ](http://localhost:8080/api/auth )
### Crates Used
2018-12-09 16:55:36 +01:00
2022-02-06 09:25:38 +01:00
- [actix-web ](https://crates.io/crates/actix-web ) // Actix Web is a simple, pragmatic and extremely fast web framework for Rust.
2020-12-02 04:29:03 +01:00
- [rust-argon2 ](https://crates.io/crates/rust-argon2 ) // crate for hashing passwords using the cryptographically-secure Argon2 hashing algorithm.
2018-12-09 16:55:36 +01:00
- [chrono ](https://crates.io/crates/chrono ) // Date and time library for Rust.
- [diesel ](https://crates.io/crates/diesel ) // A safe, extensible ORM and Query Builder for PostgreSQL, SQLite, and MySQL.
- [dotenv ](https://crates.io/crates/dotenv ) // A dotenv implementation for Rust.
2019-07-18 13:55:14 +02:00
- [derive_more ](https://crates.io/crates/derive_more ) // Convenience macros to derive tarits easily
2018-12-09 16:55:36 +01:00
- [env_logger ](https://crates.io/crates/env_logger ) // A logging implementation for log which is configured via an environment variable.
- [futures ](https://crates.io/crates/futures ) // An implementation of futures and streams featuring zero allocations, composability, and iterator-like interfaces.
2019-07-18 13:55:14 +02:00
- [lazy_static ](https://docs.rs/lazy_static ) // A macro for declaring lazily evaluated statics.
2018-12-09 16:55:36 +01:00
- [r2d2 ](https://crates.io/crates/r2d2 ) // A generic connection pool.
- [serde ](https://crates.io/crates/serde ) // A generic serialization/deserialization framework.
- [serde_json ](https://crates.io/crates/serde_json ) // A JSON serialization file format.
- [serde_derive ](https://crates.io/crates/serde_derive ) // Macros 1.1 implementation of #[derive(Serialize, Deserialize)].
- [sparkpost ](https://crates.io/crates/sparkpost ) // Rust bindings for sparkpost email api v1.
- [uuid ](https://crates.io/crates/uuid ) // A library to generate and parse UUIDs.
2019-07-18 13:55:14 +02:00
Read the full tutorial series on [gill.net.in ](https://gill.net.in )
2018-12-09 16:55:36 +01:00
2020-10-14 19:04:53 +02:00
- [Auth Web Microservice with Rust using Actix Web v2 - Complete Tutorial ](https://gill.net.in/posts/auth-microservice-rust-actix-web1.0-diesel-complete-tutorial/ )
2020-01-12 13:11:12 +01:00
2021-10-06 23:28:53 +02:00
### Dependencies
2020-01-12 13:11:12 +01:00
On Ubuntu 19.10:
```
sudo apt install libclang-dev libpq-dev
```