node.jsoauth-2.0zapierzapier-cli

How do I manually refresh-token while creating apps using Zapier CLI


I want to perform refresh token but my gateway gives HTTP response 403 instead of 401 so I cannot use 'autoRefresh' feature of Zapier.

I tried throwing 'RefreshTokenException' when the response status is 403 as given below:

return responsePromise
    .then((response) => {
    if (response.status == 403) {
        throw new RefreshTokenException(); 
    }  
    ...
});

But upon doing this I get an Error from Zapier (while creating zaps) stating:

RefreshTokenException is not defined

Can anyone help me with manually refreshing token using Zapier CLI platform for app creation?


Solution

  • David here, from the Zapier Platform team. Sorry for the slow reply, we're just now seeing some of these.

    It's not defined because that's not an error we define. You've got the right idea, you just need to use RefreshAuthError instead. See these docs.

    ​Let me know if you've got any other questions!