question

newuser-8aeb3f79-e874-4321-b35b-1323020dbfa9 avatar image

Retrieving api access token fails on assignment

Hi All!

I am trying to retrieve api access token from a user.

I'm not sure if I shall do:

  • handler_input.request_envelope.context.system.api_access_token
  • ask_utils.get_api_access_token(handler_input)

Both of them retrieve the access token when printing it, however, when assigning it, I get error:

 [ERROR] AttributeError: 'NoneType' object has no attribute 'system'Traceback (most recent call last):  File "/opt/python/lib/python3.8/site-packages/ask_sdk_core/skill_builder.py", line 111, in wrapper    response_envelope = skill.invoke(  File "/opt/python/lib/python3.8/site-packages/ask_sdk_core/skill.py", line 181, in invoke    api_token = request_envelope.context.system.api_access_token
apipython
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Amazon_Bernardo Bezerra avatar image
Amazon_Bernardo Bezerra answered

Hello and sorry it took so long to get to your question.

Not all the requests sent to your skill will contain the context.system.api_access_token, so ideally you should test all the requests before extracting it.

Regards,
Barry

10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.