CallBack API get access token timeout and recovery?

It seems that getting the accessToken for the callbackAPI is limited by to a timeout, somewhere around 60 second ?

Made several successful calls to obtain the AccessToken (as below), however after around 60 seconds an error is returned.

That means in the event that this fails, the 3rd party app basically is broken and cannot send any events because it can’;t get a callback AccessToken anymore.? The user of the app may not be aware of this.

Should the flow then be, that wen receiving the callback event, to make a call the callback to to get the accessToken, before returning from the call back event or it fails and is not successfull within the timeout period ? If yes, then what should be returned to the CallBack grant request if the token was not successfully obtained. Will ST then resend the Callback request?

{‘headers’: {‘schema’: ‘st-schema’, ‘version’: ‘1.0’, ‘interactionType’: ‘accessTokenResponse’, ‘requestId’: ‘def-123-456’}, ‘callbackAuthentication’: {‘tokenType’: ‘Bearer’, ‘accessToken’: ‘eyJhbGciOiJIUzM4NCJ9.MTd…G8K’, ‘refreshToken’: ‘eyJhbG…73GfI’, ‘expiresIn’: 86400}}

{‘headers’: {‘schema’: ‘st-schema’, ‘version’: ‘1.0’, ‘interactionType’: ‘accessTokenRequest’, ‘requestId’: ‘def-123-456’}, ‘globalError’: {‘errorEnum’: ‘INVALID-CODE’, ‘detail’: ‘the provided code is invalid’}}

  1. You will get a call back token on subscribed events, this one is a short lived token that can be used to request information based on a received event.
  2. You will have a token that is issued along with a refresh token. You need to manage these tokens for all of your out of band requests or updates. For token management, you should store the refresh token along with the expiresIn value. If the expires in value is greater than the length of time since it was issued, you will need to use the refresh token to obtain a new token.

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.