Authentication Login
Similar to the registration process, the authentication login process is as follows:
Below is the JavaScript API code to call the login function.
const result = await JwtEAuth.userLogin(user);
if (result.status == "success") {
//.. success
} else {
//.. error
}
const user = {
userName: user_name_value,
};
{
"status": "success",
"code": "cr-220", // See the complete status codes in the response and status codes section.
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXlsb2FkIjp7InRva2VuSWQiOiJnelpNREJzOFhtUlpFaGF5MGtHLWk0cmc2bTFzMVg2MmxscXMwQldlZmZrIiwidXNlck5hbWUiOiJCVURJIEtBWlVFIiwicm9sZSI6IlRCRCJ9LCJpYXQiOjE3MzI2NTQ0ODcsImV4cCI6MTczMjY1NDU0NywiYXVkIjoicGxheWdyb3VuZC5pbnZlc3RlY2hmeC5teS5pZCIsImlzcyI6Imp3dGVhdXRoIn0.xbrlh4yUfG6nJ173anCidd_pdlsneywafSShT4skRcI"
}
JWT Token Payload
The JWT Token does not contain sensitive information and is solely used for verifying the authenticity of the token, ensuring that it originates from the JWTEAuth service.
When you submit a login request and JWTEAuth successfully validates the credentials with a valid signature, you will receive a success response along with a JWT Token. This token is used to verify the authenticity of the token you received from the JWTEAuth service. The JWT Token is hashed using the HMAC SHA-256 algorithm. Below is the payload of the JWT Token:
{
"payload": {
"tokenId": "gzZMDBs8XmRZEhay0kG-i4rg6m1s1X62llqs0BWeffk",
"userName": "BUDI KAZUE",
"role": "TBD"
},
"iat": 1732654487,
"exp": 1732654547,
"aud": "playground.investechfx.my.id",
"iss": "jwteauth"
}
Info: After you make a registration request and receive a response, you need to update the user's data and mark that the user has completed the registration.
📅January 13, 2025