2
votes

I am getting 403 Forbidden when I try to get location details through Amazon location API.

I have enabled "Request users to access resources and capabilities." but still I get a 403 Forbidden response?

1
Please add your code into your original post, it won't fit in comments. - Jake Lee
Please edit your code into the question. - Tim Diekmann

1 Answers

3
votes

The apiAccessToken is included in all request to your skill, but it doesn't mean that you have access to resources. You will have to either explicitly grant access to your skill under Settings menu of your alexa skill or you will have to send a permission card to the user for consent.

In node sdk you can send a permission card like this:

return handlerInput.responseBuilder
      .speak(speechOutput)
      .withAskForPermissionsConsentCard(['read::alexa:device:all:address'])
      .getResponse();

where read::alexa:device:all:address is the permission value for Device Full Address.

Once the permission is granted, fire a GET request with deviceId and apiAccessToken to the specified apiEndpoint

Endpoint for Full Address is: /v1/devices/*deviceId*/settings/address

Country/region & postal code: /v1/devices/*deviceId*/settings/address/countryAndPostalCode

More info here

Hope this helps!