62dolphin microservice is a REST API writter in Golang designed for authenticaction with Json Web Token
Created by 62teknologi.com, perfected by Community.
View table of contents
This introduction will help You explain the concept and characteristic of Authenetication.
Authentication is the process of verifying the identity of a user or other entity in a system. It is done to ensure that only authorized users or entities can access resources or perform certain actions.
In the context of 62dolphin, authentication refers to the process of verifying user credentials (such as username and password) to grant access to protected resources or services. This is typically done using an authentication token, such as a Json Web Token (JWT).
- User Credentials (e.g., username and password)
- Authentication Token (e.g., JWT)
- Token Expiration Time
- Access Rights or Permissions
- Can Authenticate (Log in)
- Can Verify Authentication Token
- Can Refresh Authentication Token
- Can Revoke Access or Invalidate Authentication Token
- Associated with the Authenticated User or Entity
- Associated with the Protected Resources or Services
- Associated with the Granted Access Rights or Permissions
Follow the instruction below to running 62dolphin on Your local machine.
Make sure to have preinstalled this prerequisites apps before You continue to installation manual. we don't include how to install these apps below most of this prerequisites is a free apps which You can find the "How to" installation tutorial anywhere in web and different machine OS have different way to install.
- MySql
- Go
This installation manual will guide You to running the binary on Your ubuntu or mac terminal.
- Clone the repository
git clone https://github.com/62teknologi/62dolphin.git
- Change directory to the cloned repository
cd 62dolphin
- Initiate the submodule
git submodule update --init
- tidy
go mod tidy
- Create .env base on .env.example
cp .env.example .env
- setup env file like this
ENVIRONMENT=development
DB_SOURCE_1=user:db_pass@tcp(db_ip:db_port)/db_name?charset=utf8mb4&parseTime=True&loc=Local
DB_SOURCE_2=
HTTP_SERVER_ADDRESS=0.0.0.0:7001
MONOLITH_URL=http://localhost:8001
API_KEY=
FIREBASE_CONFIG_PATH=
TOKEN_SYMMETRIC_KEY=12345678901234567890123456789012
ACCESS_TOKEN_DURATION=24h
REFRESH_TOKEN_DURATION=87h
- Build the binary
go build -v -o 62dolphin main.go
- Run the server
./62dolphin
The API server will start running on http://localhost:7001
. You can now interact with the API using Your preferred API client or through the command line with curl
.
GET /health
POST /api/v1/auth/sign-in
POST /api/v1/auth/sign-up
GET /api/v1/auth/:adapter
GET /api/v1/auth/:adapter/callback
POST /api/v1/auth/:adapter/callback
POST /api/v1/auth/:adapter/verify
POST /api/v1/otps/create
POST /api/v1/tokens/create
POST /api/v1/tokens/verify
POST /api/v1/tokens/refresh
POST /api/v1/passwords/create
POST /api/v1/passwords/check
POST /api/v1/passwords/forgot
PATCH /api/v1/passwords/reset/:token
GET /api/v1/users
POST /api/v1/users
GET /api/v1/users/:id
POST /api/v1/users/verify
POST /api/v1/tokens/block
POST /api/v1/tokens/block-all
PUT /api/v1/users/:id
DELETE /api/v1/users/:id
You can check all endpoint on docs
you can edit your response config for your application needing, like login response just show id, email, name.
you can check json configuratin here. base on this json. you can custom your user reponse in user object example
{
"session_id": "",
"access_token": "",
"access_token_expires_at": "",
"refresh_token": "",
"refresh_token_expires_at": "",
"platform_id": "",
"user": {
"id": 0,
"email": ""
}
}
in this section you can also custom your request, ex for login request. you can check request validadtion example. in this example we make email and password required
{
"auth_field": "email|username",
"email": "required|email",
"username": "",
"password": "required",
"platform_id": 0
}
If You'd like to contribute to the development of the 62whale REST API, please follow these steps:
- Fork the repository
- Create a new branch for Your feature or bugfix
- Commit Your changes to the branch
- Create a pull request, describing the changes You've made
We appreciate Your contributions and will review Your pull request as soon as possible.
- Reduce repetition
- Easy to use REST API
- Easy to setup
- Easy to Customizable
- high performance
- Robust data validation and error handling
- Well documented API endpoints
This project is licensed under the MIT License. For more information, please see the LICENSE file.
E.nam\Du.a
Indonesian language; spelling: A-num\Due-wa
Origin: Enam Dua means ‘six-two’ or sixty two. It is Indonesia’s international country code (+62), that was also used as a meme word for “Indonesia” by “Indonesian internet citizen” (netizen) in social media.