mikeflynn/go-alexa

AudioPlayer requests failing at application ID verification

rking788 opened this issue · 1 comments

AudioPlayer requests sent to inform the skill server about playback state changes do not include a Session object since they are not tied to a user session, leading to an automatic 400 response. This means the application ID is passed in the context property of the request. This application ID should be used for the verification step in addition to the session object to cover all the bases.

More information about these playback state requests can be found here:
https://developer.amazon.com/docs/custom-skills/audioplayer-interface-reference.html#requests

So I posted a pull request for this without testing it as thoroughly as I should have. It seems like the logic in the skillserver.go file will need to be changed as well. The issue now is that the checks in for the request type are now failing since the request is not one of IntentRequest, LaunchRequest, or SessionEndedRequest. Here is a sample playback request:

{
    "version": "1.0",
    "context": {
        "AudioPlayer": {
            "offsetInMilliseconds": 0,
            "token": "12345",
            "playerActivity": "PLAYING"
        },
        "System": {
            "application": {
                "applicationId": "<REDACTED>"
            },
            "user": {
                "userId": "<REDACTED>",
                "accessToken": "<REDACTED>"
            },
            "device": {
                "deviceId": "<REDACTED>",
                "supportedInterfaces": {
                    "AudioPlayer": {}
                }
            },
            "apiEndpoint": "https://api.amazonalexa.com",
            "apiAccessToken": "<REDACTED>"
        }
    },
    "request": {
        "type": "AudioPlayer.PlaybackStarted",
        "requestId": "<REDACTED>",
        "timestamp": "2017-12-12T02:50:17Z",
        "locale": "en-US",
        "token": "12345",
        "offsetInMilliseconds": 0
    }
}