question

InnovationLab avatar image
InnovationLab asked

INVALID_ACCESS_TOKEN_EXCEPTION

Using Postman to send events to Alexa gateway for my virtual contact sensor. Everything goes through correctly, but I keep receiving an error response:

{
    "header": {
        "namespace": "System",
        "name": "Exception",
        "messageId": "134d1b07-3e6c-44db-9292-3cda81210b6d"
    },
    "payload": {
        "code": "INVALID_ACCESS_TOKEN_EXCEPTION",
        "description": "Access token is not valid."
    }
}

Heres a picture of my Authorization for the access token:


Heres how I get the token:

Also heres my body for the change report i am sending:

{
  "context": {},
  "event": {
    "header": {
      "messageId": "abc-123-def-456",
      "namespace": "Alexa",
      "name": "ChangeReport",
      "payloadVersion": "3"
    },
    "endpoint": {
      "scope": {
        "type":"BearerToken",
        "token":"Same token :)"
       },
       "endpointId" :  "sample-sensor-01" 
    },
    "payload": {
      "change": {
        "cause": {
          "type": "PHYSICAL_INTERACTION"
        },
        "properties": [
          {
            "namespace": "Alexa.ContactSensor",
            "name": "detectionState",
            "value": "DETECTED",
            "timeOfSample": "2017-02-03T16:20:50.52Z",
            "uncertaintyInMilliseconds": 0
          },
          {
              "namespace": "Alexa.EndpointHealth",
            "name": "connectivity",
            "value": {
                "value": "OK"
            }
          }
        ]
      }
    }
  }
}


What am I doing wrong? pls help! thanks


alexaalexa smart homesmart home
1565297879198.png (87.8 KiB)
1565297956588.png (69.4 KiB)
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Gaetano@Amazon avatar image
Gaetano@Amazon answered

Hi,

thanks for your post.

Please make sure you are using the Client ID/Client Secret pair from the "PERMISSIONS" section of the "Build" tab.

This is the correct identity to POST to the Alexa Event Gateway.

Kind regards,
Gaetano

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.