alexa / alexa-skills-kit-sdk-for-nodejs

The Alexa Skills Kit SDK for Node.js helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Apache License 2.0
3.12k stars 736 forks source link

updateAccountLinkingInfoV1 is not working #652

Closed z4o4z closed 3 years ago

z4o4z commented 3 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}}'
}

P.S. issue in alexa-apis-for-nodejs: https://github.com/alexa/alexa-apis-for-nodejs/issues/10 PR in alexa-apis-for-nodejs: https://github.com/alexa/alexa-apis-for-nodejs/pull/11

ShenChen93 commented 3 years ago

Hi @z4o4z ,

Thanks for point this issue out. Since our model pkg is auto-generated, thus we won't accept PR for the fix. Instead, we will fix this issue and release new model pkg soon.

Thanks, Shen

ShenChen93 commented 3 years ago

Hi @z4o4z ,

ask-smapi-model 1.12.1 was released with following changes: https://github.com/alexa/alexa-apis-for-nodejs/commit/acf06346c740d5e923e4cc13a097637046aec693. Could you please update model version and let us know if it works correctly.

Thanks, Shen

ShenChen93 commented 3 years ago

Close this issue for now, please reopen if the issue still exit.

Thanks, Shen