Question

403 error while using Session Auth

  • 2 October 2021
  • 5 replies
  • 205 views

Please help!.
1. I am using UI platform and switched to code for parsing the response
2. Session auth connection is working and all tests went successful,I added one zap with trigger.  Access_token expired after 15 minutes (saw in monitoring tab)
3. I found solution in community posts and added in response. 
   if (response.status === 403 || response.status === 401) {
    throw new z.errors.RefreshAuthError();
  }
In trigger request.
4. This solved 403 error partially, so I can see trigger is checking for new data and I can see eight status=200 responses   and four (4)are still status=403 errors. How can I get rid of 403?
5 What are bundles (8 now on monitoring )

here is my code
 


 

 


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

5 replies

I have the same problem with handling a 403.

I have added (in Zapier ui with Session auth) the following:

return z.request(options).then((response)=> {
  if (response.status === 403) {
    throw new z.error.RefreshAuthError();
  }
    response.throwForStatus();
    const results = response.json;

    // You can do any parsing you need for results here before returning them

    return results;
  });

 

However with a zap running (after the first token has expired), I get the error: 

Cannot read property 'RefreshAuthError' of undefined

 

Can someone help me with this problem?

Userlevel 7
Badge +11

Hey @Abdur and @HielkeRijpstra!
 

@Abdur, it looks like you also reached out to our Support team and had set up your integration correctly to refresh the token. So it looks like you might be all set here. :)
 

@HielkeRijpstra, I did some digging and it looks like similar issues have been discussed in the following threads:


Hopefully the information in those threads will be helpful in finding a solution. If not, please do reach out to our Support team and they’ll be happy to help further on this! :)

Hi Sam,

Thanks for the links to other solutions. However if I try these, i stil get the Cannot read property 'RefreshAuthError' of undefined.

This is my handling of the reponse. 

z.request.skipThrowForStatus = true; // deal with 403 our selves

  return z.request(options).then((response) => {
  if (response.status === 403) {
    throw new z.errors.RefreshAuthError();
  }  // when 403 then get new bearer token
  response.throwForStatus();
  return response.json;
});

I can see that it catches the 403, but the bearer token is not refreshed:
What happened (You are seeing this because you are an admin):
  Starting POST request to https://heimdall.bouw7.nl/project
  Received 403 code from https://heimdall.bouw7.nl/project after 526ms
  Receive

I am using the UI of zapier, but not sure how i can fix this. Can you help me?

@SamB Could you help me out? 

I am struggling with the authentication as mentioned in my previous question.

Userlevel 7
Badge +11

Hey @HielkeRijpstra!

I’m so sorry you’re still running into some trouble on this. :( Hmm, it looks as though the code you’re using is a match for the code that was mentioned as having worked in this related thread:


I’m not too sure why it’s not working in your case. As I’m not able to dig into the set up or logs for your integration, I’d really recommend contacting our Support Team for further assistance via the Get Help form. They’ll be better placed to advise on any changes that you may need to make to the setup of your integration.