Auth

OAuth2 with a token enables us to authenticate your API requests.

POST/v2/auth/token

Create a bearer token

This endpoint allows you to generate the bearer token needed to authenticate all the other APIs.

Required attributes

  • Name
    client_id
    Type
    string
    Description

    Unique client id provided by your Avon Health contact for accessing the API.

  • Name
    client_secret
    Type
    string
    Description

    Unique client secret provided by your Avon Health contact for accessing the API.

Request

POST
/v2/auth/token
curl https://{{base_subdomain}}.avonhealth.com/v2/auth/token \
  -d client_id="dBez7drjJAM22Q4G5HqaHpE4wzWZnbmj" \
  -d client_secret="8Iukm2ctLEEWt6Oz9UCGoEsLxGjX7xkDW8qoS9WVKtcB8yekokk9S2FQTYKnycdQ"

Response

{
    "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkRHQ29BcElVd04tTm5ZTG1KZXMzSSJ9.eyJpc3MiOiJodHRwczovL2Rldi11NXlsam1oci51cy5hdXRoMC5jb20vIiwic3ViIjoiZEJlejdkcmpKQU0yMlE0RzVIcWFIcEU0d3pXWm5ibWpAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vYXBpLmF2b25oZWFsdGguY29tL3YxLyIsImlhdCI6MTY4MzY1NjU4NiwiZXhwIjoxNjgzNzQyOTg2LCJhenAiOiJkQmV6N2RyakpBTTIyUTRHNUhxYUhwRTR3eldabmJtaiIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.ITll5pvkEAOOdhQCsohmAvIt08VmFGbHwHlYOPgENdSen1ID3eL2KUzqbqb1ICfmHn3T8R5P3X9L22c78LlQooRB6Sp3BMI6FASvdER_TeWqnzr5ZVwgpSBnnisdWNqpSpccTrYWlzMjDaxm6r6OT9gw7j53d0JOqcCmwaOvQ2Q3DijwpjWAif6a-EiorMBjza7717grfvYNKsw14qPdeq_k3lL4bEqc01ayY_dwVjVILcCktiUnsbgbPHBVaJ4Oki_cTxFRk37DxglR8dcdnCWzEJDQXVo9--IdB0X2Ux6-JKSDbnpjyes5kbn9n4CdXl2jBXGPQT8YradlXDR9Rw",
    "expires_in": 86400,
    "token_type": "Bearer"
}

POST/v2/auth/get-jwt

Create a jwt token

This endpoint allows you to generate the jwt token needed the user sending the API request.

Required attributes

  • Name
    id
    Type
    string
    Description

    Unique user ID that you want to generate the token for.

Request

POST
/auth/token
curl https://{{base_subdomain}}.avonhealth.com/v2/auth/get-jwt \
  -d id="user_Z1zXZKvqrpwxbznuW6lJ"

Response

{
    "jwt": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkRHQ29BcElVd04tTm5ZTG1KZXMzSSJ9.eyJpc3MiOiJodHRwczovL2Rldi11NXlsam1oci51cy5hdXRoMC5jb20vIiwic3ViIjoiZEJlejdkcmpKQU0yMlE0RzVIcWFIcEU0d3pXWm5ibWpAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vYXBpLmF2b25oZWFsdGguY29tL3YxLyIsImlhdCI6MTY4MzY1NjU4NiwiZXhwIjoxNjgzNzQyOTg2LCJhenAiOiJkQmV6N2RyakpBTTIyUTRHNUhxYUhwRTR3eldabmJtaiIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.ITll5pvkEAOOdhQCsohmAvIt08VmFGbHwHlYOPgENdSen1ID3eL2KUzqbqb1ICfmHn3T8R5P3X9L22c78LlQooRB6Sp3BMI6FASvdER_TeWqnzr5ZVwgpSBnnisdWNqpSpccTrYWlzMjDaxm6r6OT9gw7j53d0JOqcCmwaOvQ2Q3DijwpjWAif6a-EiorMBjza7717grfvYNKsw14qPdeq_k3lL4bEqc01ayY_dwVjVILcCktiUnsbgbPHBVaJ4Oki_cTxFRk37DxglR8dcdnCWzEJDQXVo9--IdB0X2Ux6-JKSDbnpjyes5kbn9n4CdXl2jBXGPQT8YradlXDR9Rw",
}