Technical Services
Non Insurance Services
Deprecate
JWT Authentication Service
Sidebar On this page

Description

JSON Web Token(JWT) is a method for authentication and is a compact and self-contained data type for secure transmission of information.

Data Structure

The overall structure of JWT data is as follows:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ

It is a long string with a dot (.) in the middle, separating it into three parts. Note that there is no line break within the JWT; it is just written here as a few lines for better presentation.

The three parts of the JWT are showed as follows:

- Header
- Payload
- Signature

Token Management

Get Token

  • Request

    xxx in the Basic xxx is base64 data generated after base64(username:password:tenant code)

    curl --location --request POST 'https://dev-gw.insuremo.com/eBao/1.0/auth/grantToken' \
    --header 'Authorization: Basic xxx' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "expireIn": 3600
    }'
  • Response

    {
    "message": "",
    "token": "eyJhbGciOiJSUCI6IkpXVCJ9.eyJleHAiOjE2NzI4MDlIjoiamFuLnpoYW5nIiwidGVuYW50IjoiZUJhbyJ9.IVm_ljm0HtFVf_ESWZFR5CmUMk9ZP-aMIXWkDIBRCUK7oY9qKA4AT9BFIUw8W3u4xjGSZ26yIuS9ON8zM5vnfPeyHuQ21I-IqgK4tJl6DtVoSyb_8tOkPZPSGUfsv0KtWcmq_ydWxpiP25mTY3k3NucnR1GwxTAzeThZkcZIFjJFkaVxaaTdrfpz4ntjkWT68mL2C5ihatk31KVy-79m5KoqYioSTdlDu0g4We_Z_HJHFL-H3q67yq8cdrF0lpcjn3wgx4lAHrDjlGa4ykFeTN_gA",
    "expire_in": 3600
    }

Verificate Token

  • Request

    curl --location --request POST 'https://dev-gw.insuremo.com/eBao/1.0/auth/checkToken' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "token": "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDA2NjU5NzEsInVzZXJOYW1lIjoiamFuLnpoYW5nZGV2NSIsInRlbmFudCI6ImVCYW8ifQ.lez7ANV5vyevFdf6Vl0OK_B8umK1_EwlUSEVx9mQP-u09IKc3HuXlyQakowdQprFsd31MZ8SkRLJpzdbRBLtZNstHTs0zgTGrFhbY3jGtTaiMWZ5GXw4toa5zC5-akEhDll83YaxuL2vSJdxpHF7ThVl0RSTcX8xVj9HV9hxKwZuddwcCVsp_4ir6HEXZTV-I7LQRDvA_OxauL7KFDP1IOLyr-RyzYgUJYy3LSe-_Clpcdl6HOhse66PPWYFOzx324rZLiBQoJjun4E33LXcz_kvPLaUdrtwNFL12yCg58u5Bc76ZFeIRaQo2QqXSlGTbJ8ZQK9I56LrHuSFyPoYzQ"
    }'
  • Response

    {
    "message": "",
    "authed": true,
    "userName": "your-user-name",
    "tenant": "your-tenant"
    }

Refresh Token

A new token can be obtained by refreshing it with an expiring token.

  • Request

    curl --location --request POST 'https://dev-gw.insuremo.com/eBao/1.0/auth/jwt/refresh' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "token":"Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTc2MzY0MTAsInVzZXJOYW1lIjoiamFuLnpoYW5nZGV2NSIsInRlbmFudCI6ImVCYW8ifQ.RIMOscARd_4ad1QAK_lOAcPPySo_3s5QEoXpyvV8xFn9uLIVm0EN-3zesZ-8E8qmIxuWNPOOPYerF4VZyprpRZf7ad7iMFlGxDUlVQ5LJIP8-k-aA4Mjzizcu_JZhxXeYcZBiqViBadOVEIDKjX5jJBHqW5mUn_1bz7E3TBMGsnh7tPHu_ico2PDdA_z7Ig0epajoR5V_ip5d0YyJEEQYMQKil4Fu8gg9Tr3c_iH6hsoyZPPRvkr6pCsc0oPiGlI5N9Sb9bTW2jDU6ZQmfoqD6o-Cs23qpGVWxVBYCdulAHfTgjfAXjmkDNK2iTxT9Zk0HdRsb4HnYt15_zR0hc0Gw"
    }'
  • Response

    {
    "message": "",
    "token": "eyJhbGciOiJSUCI6IkpXVCJ9.eyJleHAiOjE2NzI4MDlIjoiamFuLnpoYW5nIiwidGVuYW50IjoiZUJhbyJ9.IVm_ljm0HtFVf_ESWZFR5CmUMk9ZP-aMIXWkDIBRCUK7oY9qKA4AT9BFIUw8W3u4xjGSZ26yIuS9ON8zM5vnfPeyHuQ21I-IqgK4tJl6DtVoSyb_8tOkPZPSGUfsv0KtWcmq_ydWxpiP25mTY3k3NucnR1GwxTAzeThZkcZIFjJFkaVxaaTdrfpz4ntjkWT68mL2C5ihatk31KVy-79m5KoqYioSTdlDu0g4We_Z_HJHFL-H3q67yq8cdrF0lpcjn3wgx4lAHrDjlGa4ykFeTN_gA",
    "expire_in": 3600
    }

Logout Token

While the expiration of a JWT token is determined by its own expiration time, we also provide an active logout API. Once logged out, the token will not be able to access any resources in the platform.

  • Request

    curl --location --request POST 'https://dev-gw.insuremo.com/eBao/1.0/auth/jwt/logout' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "token":"eyJhbGciOiJSUCI6IkpXVCJ9.eyJleHAiOjE2NzI4MDlIjoiamFuLnpoYW5nIiwidGVuYW50IjoiZUJhbyJ9.IVm_ljm0HtFVf_ESWZFR5CmUMk9ZP-aMIXWkDIBRCUK7oY9qKA4AT9BFIUw8W3u4xjGSZ26yIuS9ON8zM5vnfPeyHuQ21I-IqgK4tJl6DtVoSyb_8tOkPZPSGUfsv0KtWcmq_ydWxpiP25mTY3k3NucnR1GwxTAzeThZkcZIFjJFkaVxaaTdrfpz4ntjkWT68mL2C5ihatk31KVy-79m5KoqYioSTdlDu0g4We_Z_HJHFL-H3q67yq8cdrF0lpcjn3wgx4lAHrDjlGa4ykFeTN_gA"
    }'
  • Response

    {
    "success": true,
    "message": ""
    }

Integration Cases

Use JWT token to access API.

xxx in the Bearer xxx is the JWT token obtained by using the above API.

curl --location --request GET 'https://dev-gw.insuremo.com/eBao/1.0/email/impl' \
--header 'Authorization: Bearer xxx'

Response:

{
"body": "SMTPEmailImpl,SendgridEmailImpl",
"info": "SMTPEmailImpl,SendgridEmailImpl",
"status": 0
}

Feedback
Was this page helpful?
|
Provide feedback