Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel
nameblue

Table of Contents

...

  • Header
    • typ: The type of the token, which is JWT
    • alg: The hashing algorithm being used, which is HS256
  • Payload: contains the claims which are statements about an the user and additional metadata.
    • jti: The ID of the user session as generated by CRM.COM
    • usr: The username of the logged in user
    • org: The organisation name of the organisation that the user logged in
    • oun: The unit name of the unit that the user logged in
    • exp: The expiration time on or after which the JWT becomes invalid and should not be accepted for processing. 
    • iat: The time at which the JWT was issued
  • Signature: is used to verify that the sender of the JWT is who it says it is and to ensure that the message wasn't changed along the way. The signature is created by encoding the header and payload and signing them using a secret and the HS256 algorithm

...

Code Block
languagexml
titleBody
linenumberstrue
{
    "unit": "unit"
}

Note that the unit parameter is optional. If not specified then the default unit of the user that is represented by the specified Web API key will be used
Code Block
languagexml
titleResponse
linenumberstrue
 {
  "data": {
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c3IiOiJNUEFkbWluaXN0cmF0b3IiLCJvcmciOiJwc19yMTNxYSIsIm91biI6IjEiLCJleHAiOiIxNDk1NzIwNTgyIiwiaWF0IjoiMTQ5NTcxMzM4MiIsImp0aSI6IkM5NzI5NDlFOEZGMTRFMjI5RjU4MjkxQUJFM0MyNjYzIn0.6-9y-NTFoxjYDcnZb_Z6gVgFwPdvV82nIpuGTQ3v0wQ"
  },
  "status": {
    "code": "OK",
    "description": "",
    "message": ""
  }
}

How to Authenticate with Username & Password Method

...

Code Block
languagexml
titleBody
linenumberstrue
{
    "username": "username",
    "password": "1234",
    "organisation": "organisation",
    "unit": "unit"
}
Code Block
languagexml
titleResponse
linenumberstrue
 {
  "data": {
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c3IiOiJNUEFkbWluaXN0cmF0b3IiLCJvcmciOiJwc19yMTNxYSIsIm91biI6IjEiLCJleHAiOiIxNDk1NzIwNTgyIiwiaWF0IjoiMTQ5NTcxMzM4MiIsImp0aSI6IkM5NzI5NDlFOEZGMTRFMjI5RjU4MjkxQUJFM0MyNjYzIn0.6-9y-NTFoxjYDcnZb_Z6gVgFwPdvV82nIpuGTQ3v0wQ"
  },
  "status": {
    "code": "OK",
    "description": "",
    "message": ""
  }
}

How to Refresh Authentication Token

...