Reference taken from BLOG
Run docker image
docker-compose up -d
To Run:
go get ./
go run main.go
-
Sign up (creation of user) using email and password:
http://127.0.0.1:8000/api/auth/register/ { "name":"First", "email":"first@gmail.com", "password":"123456789", "passwordconfirm":"123456789" }
-
Sign in
a. Authentication of user credentials
b. A token is returned as response preferably JWT
http://127.0.0.1:8000/api/auth/login/
{
"name":"First",
"email":"first@gmail.com",
}
-
Authorization of token
a. Mechanism of sending token along with a request from client to service
-> Tokens sent as cookies
b. Should check for expiry
-> Validate function in token.go
c. Error handling (proper error codes in each failure scenario) -
Revocation of token
a. Mechanism of revoking a token from backend
-> Implemented in logout route, through Redis DEL function, the token will be deleted -
Mechanism to refresh a token
a. Client should be able to renew the token before it expires
-> Implemented
Used frameworks and libraries: