question

Bob avatar image
Bob asked

not getting new access token in smart home skill

I have a smart home skill that has been configured to "send alexa events"

When I link the skill, I get an accept grant request, which I process and successfully get an access_token and a refresh_token.

I can use the access token to send events until it expires.

This is where things go wrong. My understanding is that alexa should refresh the access token automatically before the old one expires? If this is the case, presumably the information is again passed to my code, but that doesn't seem to be happening?


If I try and refresh the token myself, it doesn't work - I'm following the instructions here https://developer.amazon.com/docs/login-with-amazon/authorization-code-grant.html#using-refresh-tokens

and send


POST /auth/o2/token HTTP/1.1
Content-Length: 586
Host: api.amazon.com
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
{    "grant_type": "refresh_token",    
"client_secret": "b1e1e5c8ec7d185xxxxxxxxxxxxxx0a7d0b91d2e0461104c4ca22f",   
 "client_id": "amzn1.application-oa2-client.e8cexxxxxxxxxxx19d41a2e9d4",    
"refresh_token": "Atzr|IwEBIBIYmsmBfMNxxxxxxxxxxxxxxxxxxv51y0EAKVRLUCgUQGjhAIEV8sjggjMx-20Jg5MiRc" }


but get back


HTTP/1.1 400 Bad Request
Server: Server
Date: Tue, 19 Feb 2019 15:00:15 GMT
Content-Type: application/json;charset=UTF-8
Content-Length: 110
Connection: keep-alive
x-amzn-RequestId: 10bea769-3457-11e9-8c60-e1cf020c9931
X-Amz-Date: Tue, 19 Feb 2019 15:00:15 GMT
Access-Control-Allow-Origin: chrome-extension://aejoelaoggembcahagimdiliamlcdmfm
x-amzn-ErrorType: OA2UnsupportedGrantTypeException:http://internal.amazon.com/coral/com.amazon.panda/
Cache-Control: no-cache, no-store, must-revalidate
Vary: Origin,Accept-Encoding,X-Amzn-CDN-Cache,User-Agent
Access-Control-Expose-Headers: x-amzn-RequestId,x-amzn-ErrorType,x-amzn-ErrorMessage,Date
Pragma: no-cache
Content-Encoding: gzip
x-amz-rid: 46F8QXT3ZVS73RKFZ80V
{"error_description":"The authorization grant type is not supported by the authorization server","error":"unsupported_grant_type"}

any ideas anyone?

account linkingsmart home
10 |3000 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.

Bob avatar image
Bob answered

does anyone have any idea what's wrong?

10 |3000 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.

Gaetano@Amazon avatar image
Gaetano@Amazon answered

Hi Bob,

the token refresh flow is handled via the URIs and settings you filled on the account linking tab of the skill, and not from your code.

The Alexa service is periodically making POST requests to your auth URI with the refresh token in order get a new access token.

Since this issue is related to your account, please send us the Skill-ID and and a test username/password for account linking by opening a Contact Us case here.

Kind regards,
Gaetano

1 comment
10 |3000 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.

Sorry for the delayed response, but because this silly forum doesn't send emails when updates happen I didn't know you'd replied...


I have just opened a case

1 Like 1 ·