0

I'm currently building an Alexa skill which will eventually need the users Zip Code. I'm going off of this code: https://data-dive.com/alexa-get-device-location-from-custom-skill

The problem I'm having is this line: 'TOKEN = context.System.user.permissions.consentToken' and the error: 'AttributeError: 'NoneType' object has no attribute 'consentToken''

I have already requested permissions through the Alexa dev console, but my guess is that there isn't something going right when I'm testing. I tried testing through the Alexa app on my phone but came to the same error. Any steps in the right direction would be great!

davidism
  • 121,510
  • 29
  • 395
  • 339
user2820924
  • 13
  • 1
  • 1
  • 2
  • Try to log the request and see whether the consentToken exists. BTW consentToken is now deprecated. Use apiAccessToken if you are in the early stage of development. – johndoe Jul 30 '18 at 17:59
  • Huge help in pointing out that consentToken is no longer used. However, now I'm running into a problem which gives me the error: return statement("your zip code is" + location["postalCode"].encode("utf-8")) TypeError: 'NoneType' object has no attribute '__getitem__' – user2820924 Jul 30 '18 at 18:06
  • I recommend using the test console. See https://developer.amazon.com/docs/devconsole/test-your-skill.html#test-simulator The test console show the requests sent from Alexa to you skill's backend. – Markus K Jul 30 '18 at 19:44
  • Btw. the documentation also states not to use the consentToken any more. Use `context.System.accessToken` instead. https://developer.amazon.com/docs/custom-skills/device-address-api.html#get-the-api-access-token-and-device-id – Markus K Jul 30 '18 at 19:47

1 Answers1

0

consentToken is deprecated

Requests from Alexa may also include a consentToken within session.user.permissions and context.System.user.permissions.

Existing skills that use consentToken continue to work, but the context.System.apiAccessToken property should be used instead.

For more details you can refer this link

Gautam
  • 536
  • 4
  • 14