Best answer

Session Auth issue, requesting Session Token twice after it works first time

  • 8 July 2020
  • 3 replies
  • 379 views

Userlevel 1

Hi, I am trying to setup Session Auth and am having some issues.

Everything seems to be working locally when it runs but when i deploy it and test authentication in a Zap i am getting a strange error.

 

Here is what i would expect to happen for session auth.

  1. Post request to get auth token from auth endpooint
  2. token is used in “Test” request to verify that it works

What i am seeing in logs is:

  1. Post request to get auth token from auth endpooint - Returns token
  2. token is used in “Test” request to verify that it works - Json is returned, I would think this means success and it ends here.
  3. Another post request to get auth token is performed and this time the auth token from first request  is added as a header so this fails.

I cannot figure out why this is happening. I have attached my log below that shows the three requests

 

 

 

 

icon

Best answer by adavis 8 July 2020, 23:11

View original

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

3 replies

Userlevel 7
Badge +11

Hi @adavis - I hope you’re not using your real API credentials because the access token and refresh token are exposed in plain text in the file you attached. Please remove them if possible.

Also, this doesn’t seem like it should be done in a Session Auth, rather, it should be OAuth2. (Since you have an access_token and a refresh_token).

Userlevel 1

Thanks @ikbelkirasan  ill remove the credentials, even though its just for my local test instance so no worries there.

I was thinking it was OAuth also but there isn't a site to send users to for the authentication and then callback to Zapier so i don’t think i can use that implementation method. i also dont think the api is setup to use refresh tokens even though it is returned from token server….

 

anyways i found the issue, i was replacing the headers in my calls with the Bearer access_token everytime even if it was an authorization call to the token server.

Userlevel 7
Badge +11

@adavis - Good catch! Glad you could get it sorted out!

You don’t have to worry about the credentials since they are not that sensitive.