Getting BEARER Token for a PIPE

I am trying to connect to an API and GET some files using PIPES.
Before I GET my files I need to get a BEARER Token from the target server (SIRV)

Can someone explain how I would pass this Request?
I have spent several hrs with developers who dont understand the Tadabase UI or the logic of pipes. We’ve been through every setting we could think of and we got and the furthest we got was a 400 error code.

Please please someone help me !

curl --request POST
*–url https://api.sirv.com/v2/token *
*–header ‘content-type: application/json’ *
–data '{“clientId”:“ZcnZNfzwRhjfbshefboHFoGpxWJ4p2R”,“clientSecret”:“TM3d0CfcasdasdH3x7kHJYD40qJIR3omTIGXP6wPPkXpIUKLEz/dOJ9v6LbXra3y67XsaGK7iQPmnAuD+fzj+Q==”}'

Made you some Screenshots. Also made a pipe you can use to install. Please install it as soon as you can so I can remove it.

Once you have the token you can try and use it in the next API Calls, however, when I tested other API calls they all returned 504 errors. Even when tested in Postman, so its not a Tadabase error.

@moe I don’t want to veer this topic off course but regarding bearer tokens…

How do pipes work with bearer tokens that expire after X hours? Specially looking at this…

According to their support, bearer tokens expire every 12 hours and require storing a refresh token in order to get a new bearer token.

“Then once you pass the initial authorization call, you don’t need that code value anymore, since you can pass the refresh token instead of the code value in subsequent authorization calls to fetch a new pair of tokens. Then you just need to store the refresh token so you can keep using the most recent refresh token, to keep getting new 12 hour bearer tokens. This way you only have to use the redirect URI once.”

Is this similar to what @lucasallen is looking to do or is this common behavior with bearer tokens?

@moe
Thanks for the guide, will take a look!

@tim.young
thats the exact same thing that SIRV says, we need to refresh the token when it expires.
I am a complete API newbie so your help is appreciated!

Even my developers struggle to understand this as they are used to doing it in postman. Pipes is an awesome feature, we just need to ensure we understand how to configure API Calls, or perhaps the closest Method (eg CURL) to understand the logic. Just my thoughts :slight_smile:

Hi @Moe just reviewing, installed thanks, you can remove :slight_smile:
Will let you know how I get on

Update here I managed to Get more info from account with the BEARER Token.

How would I store that BEARER Token within the API call? as a global variable?

You would likely need to store it as part of your database.

For example, you can trigger Get Access Token using a form record rule or action link and save the token to a field belonging to the logged in user. Then, use that value as a parameter and access it using the “Logged In User’s Field” in form rules.

I can clarify further if this doesn’t make sense.

In many cases you can probably create a task that will renew the token and save that new token back to the database.

However, I don’t think an API like Freshbooks would work for this. Freshbooks requires OAuth2 which would mean the user must manually log into his Freshbooks account in a browser window, then we need to get the value back this way to use for further api calls. This is different than how the other pipes work and is more similar to how the Slack, Twitter type pipes work (any pipe that says “Authorize and Install”)

If you need Freshbooks we can put it on our list.

Bottom line- its probably possible to do this, but when it comes to managing the Oauth dannce it can get pretty complex. We do this behind the scenes for Pipes we’re installing that will require Oauth2.

Some example of upcoming Oauth2 pipes are:

  • Todoist
  • Asana

While we’re on this topic, over the next week we’ll also be publishing:

  • Survey Monkey
  • Freshdesk
  • Monday.com
  • BitBucket
  • Typeform
  • Jira
  • Intercom
  • Zendesk