README ¶ cookie-authentication-go Example of cookie authentication using go, gRPC, protobuf and mysql. How to run Install docker and docker-compose. Run docker-compose up in the root directory of the project. The server will be running on port 3000. The client will be running on port 3001. The database will be running on port 3306. The database will be initialized with a user with email email: "test@test.com", password": "test" Request the resource /Login on the client localhost:3000/pb.v1.AuthService/Login. The response will contain a cookie with a UUID. POST /pb.v1.AuthService/Login HTTP/1.1 Host: localhost:3000 Content-Type: application/json Cache-Control: no-cache { "email": "test@test.com", "password": "test" } How it works The user registers with a email and password. The password is hashed using bcrypt and stored in the database. The user logs in with the email and password. The password is hashed using bcrypt and compared with the hashed password stored in the database. If the passwords match, a cookie is set with a UUID. The user can access the protected resource by sending the UUID in the cookie. Expand ▾ Collapse ▴ Documentation ¶ There is no documentation for this package. Source Files ¶ View all Source files main.go Directories ¶ Show internal Expand all Path Synopsis config gen go/pb/v1 go/pb/v1/pbv1connect handler internal common Module Click to show internal directories. Click to hide internal directories.