alexa / alexa-apis-for-nodejs

The Alexa APIs for NodeJS consists of JS and Typescript definitions that represent the request and response JSON of Alexa services. These models act as core dependency for the Alexa Skills Kit NodeJS SDK (https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs).
Apache License 2.0
60 stars 35 forks source link

updateAccountLinkingInfoV1 is not working #10

Closed z4o4z closed 2 years ago

z4o4z commented 4 years ago

the method updateAccountLinkingInfoV1 is not working, the server returns such error:

{
  statusCode: 400,
  body: '{"message":"Account linking information is not valid.","violations":[{"code":"INVALID_REQUEST_PARAMETER","message":"Parsing error due to empty body.","validationDetails":{"originalInstance":{"type":"BODY"},"reason":{"type":"EXPECTED_NOT_EMPTY_VALUE"}}}]}',
  headers: [...]
}

after some investigation, I've found that this method sends the data in the body in the wrong format:

{
  url: 'https://api.amazonalexa.com/v1/skills/.../stages/development/accountLinkingClient',
  method: 'PUT',
  headers: [...],
  body: '{"type":"AUTH_CODE","scopes":[""],"domains":[""],"clientId":"id","clientSecret": "...", "accessTokenUrl":"https://example.com","authorizationUrl":"https://example.com","accessTokenScheme":"HTTP_BASIC","defaultTokenExpirationInSeconds":3600,"skipOnEnablement":false}'
}

but the correct request should contain linking data in the accountLinkingRequest field:

{
  url: 'https://api.amazonalexa.com/v1/skills/.../stages/development/accountLinkingClient',
  method: 'PUT',
  headers: [...],
  body: '{"accountLinkingRequest": {"type":"AUTH_CODE","scopes":[""],"domains":[""],"clientId":"id","clientSecret": "...", "accessTokenUrl":"https://example.com","authorizationUrl":"https://example.com","accessTokenScheme":"HTTP_BASIC","defaultTokenExpirationInSeconds":3600,"skipOnEnablement":false}}'
}