OAuth for Zoho Mail Continuous Signout

I created a pack to connect to Zoho Mail APIs and it is working beautifully. However, I am constantly getting signed out of my zoho connection.



Congrats on the Pack! I think issue here is that their API is returning a 404 when the OAuth2 access token has expired, and Coda expects a 401 in that scenario:


From: Authenticating using OAuth - Coda Pack SDK

To work around this you’ll need to add some error handling that detects these OAuth2 errors and re-throws them with a 401 status code. It could look something like:

try {
  // Make request ...
} catch (e) {
  if (coda.StatusCodeError.isStatusCodeError(e)) {
    if (e.body.data?.errorCode == "INVALID_OAUTHTOKEN") {
      // Change the status code to 401.
      e.statusCode = 401;
    }
  }
  throw e;
}
1 Like

P.S. - You’ll need this sort of error handling everywhere you make a request to their API, so you may want to leverage the a common error handling function:

1 Like

Thank you, Eric!
Works perfectly

1 Like

Was this pack released?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.