Definitive error codes and responses

I believe that I am misinterpreting error codes. When I connect in any way, first I check for the http return value, if it is not 200 (OK) I check to see what it is. I have copied the error codes from the api, but perhaps I am drawing a conclusion too soon or incorrectly?

If I receive 401 and "invalid_client" I delete all authorization and request a new pin, my assumption is that this is the first run and a new pin is required.
"authorization_pending" I assume that we are waiting for a pin entry and check every 45 seconds for pin entry.
"authorization_expired" I refresh tokens.

Additionally, if I receive a response code while making a request, I parse the error and take action based on the error. On Error 14, I refresh tokens.

At some point, I must receive an "invalid_client" error because after about 3 days I see my program has new pin for entry. These are the only error/response codes my program reacts to. Thanks.
1 person has
this question
+1
Reply
  • MarkK (API Architect) January 02, 2014 14:29
    Hi,

    There are two sets of error codes. The first being the OAuth specification error codes which are returned whenever you call /authorize or /token. Those errors are documented in the authorization method you chose. The errors you are listing are all OAuth codes, they are only applicable to the authorization process.

    "invalid_client" means your app key is invalid/revoked. It will not help you to re-authorize in this case.

    "authorization_expired" means the user took longer than 10 mins to enter the PIN and so it expired. You should start again.

    OAuth defines the standard error codes and HTTP codes and so we have to return those for the OAuth handshake. After you are done with OAuth, we have our own API error codes.

    Once you have your access/refresh tokens, the error codes you are interested are the ones here:
    https://www.ecobee.com/home/developer...

    The error code 14 (refresh token) is your signal to refresh your access token. At this point you should be looking at the error code in the response if the HTTP response code is not 200.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned