Question

Authentication error on action for custom API for tracking UPS packages

  • 7 September 2022
  • 11 replies
  • 1359 views

Userlevel 2
Badge +1

I have created a new custom API to connect to the UPS API for tracking package delivery statuses.  I set up and was successful at getting a token with Basic Auth and the Client Credentials OAuth method.  Here’s the response I get from the Authentication within Zapier (with the client_id and access_token trimmed):

{

  "token_type": "Bearer",

  "issued_at": "1662523536426",

  "client_id": "2fkN……….",

  "access_token": "eaWQi…...",

  "scope": "",

  "expires_in": "14399",

  "refresh_count": "0",

  "status": "approved"

}

 

I have set up an action to retrieve the tracking information according to the Tracking GET call from their documention.  However, I get the following error when I test an active tracking number I have:

 

The app returned "Invalid Authentication Information.".

 

When I look at the HTTP response, I can see it getting a token as part of the request, but it still is failing or not passing it.  I would appreciate any insights as to why this is not working.

 

Other things I’ve tried before creating this post

  • Tried to authenticate (unsuccessfully) with:
    • API Key Authentication
    • Session Auth
    • OAuth2 (this is for a different service that does not match my requirements)
  • Walked through the CURL request on the API documentation site and made sure all the fields were being passed
  • Searched in forums related to custom programming with same errors, no results.
  • Ask Fedex API team for help, but they are not familiar with Zapier (lame, I know)
  • Offered burnt offering to the programming gods

 

 

 


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

11 replies

Userlevel 1
Badge +1

Wow - I’m surprised to hear that the burnt offering didn’t appease the programming gods!

I’m sorry that you’re having some trouble here though, and in truth I’m also a little confused by the UPS API documentation. Despite this, I think the missing detail here is the `scope` parameter that we can see included with the response.

Essentially, my hunch is that while you got a valid token, that token might not have any scope to access resources. Perhaps I’m reading it too literally - but it looks to me like the auth endpoint needs a `grant_type` property in the request body which specifically contains the string, “client_credentials”. Currently, it looks like your app is passing the integer 1 in this property.

Could you please give that a try with a new API connection?

I also wasn’t able to see where the `client_secret` is currently being included with the authentication request - could you please confirm whether this was removed during testing? To be fair, this page doesn’t list it as a requirement, but this page does - albeit somewhat ambiguously.

I’m sorry I can’t provide a concrete answer for you here, and if my suggestion above doesn’t help - I wonder whether we might be able to glean the specific API requirements from an example (hopefully) provided by UPS when using the yellow “Authorize” and “Try it out” buttons on the docs pages.

I’m curious to hear how it goes; best of luck!

Userlevel 2
Badge +1

Hi Christian,

Thanks for your detailed response.  I have made the changes you mentioned and am still getting the same result.  Now the only part I was confused about was you asked for a “new API connection”.  Are you suggesting I try a different kind of authentication other than Basic Auth?  Also, I am passing the access_token through the Computed Field, but I read somewhere (I can’t find the link now) that you can’t use these with Basic Auth?  If that’s the case, then I’ll have to try to get another Auth mechanism working, as I could only get Basic Auth to work with Zapier.  Thank you very much for your help!  I got all the other ones working, except UPS---so frustrating!

Userlevel 2
Badge +1

This is the post I was referring to about passing the values from the Auth to the actions:  

 

Userlevel 2
Badge +1

I just noticed above that I said I contacted FEDEX API support, and I meant the UPS support.

Userlevel 6
Badge +8

Hi @pesmonde !

It sounds like you’re able to get a token from the token/ endpoint, but when you try to get tracking details that’s when you get the error, is that right?

Questions:

  1. Does Zapier give you an authentication? 
  2. Have you tried the “Test Connection” button on that authentication to see if it works?
  3. Is this problem happening with your UPS or UPS API app? (Or another?)

Things to try:

  1. Take the token and do a “manual” API request via curl or postman or insomnia to see if that works
Userlevel 2
Badge +1

Hi @shalgrim, thanks for your reply.  Here’s the answers to your questions:

 

  1. I can get authentication to work with Basic Auth, yes.
  2. Yes, I have tested it and it works for that step.
  3. This is happening on my custom API that I am developing on Zapier platform.  I can successfully test all of my keys/secrets through their interface--just not on zapier.

I have tested via Postman and it works, I think it is a Zapier issue--but since their support does not formally help with this, I am stuck in these forums for help.  @Christian W did answer a few initial questions, but I haven’t heard back from my above questions.  Thanks for your help!

Userlevel 6
Badge +8

Hey @pesmonde 

> This is happening on my custom API

I see five different apps in your developer account. One is named UPS. Another is named UPS API. What app are you working on here?

Userlevel 2
Badge +1

@shalgrim -- It is the regular UPS one.  I created the UPS API one as a test from the response from @Christian W   I cannot get the API one to work at all, but the regular one I can get the auth to work, but not the action.

Userlevel 6
Badge +8

Hm, so you’re able to get tracking details with Postman but not Zapier. The only way I can think to narrow down where things are going wrong is to compare all of the details between the two requests to see what’s different. This includes the request parameters and headers. We can help get all those details from our logs, except censored for secrets like Authorization, client_id, and client_secret, but of course you’d have the id and secret and can get the access token from testing…

Another potential avenue is to look through the results on this Google search for the error code being returned and see if any of them pertain to your situation.

I’ve confirmed with our platform support team that you’re more than welcome to reach out at the link I posted above and, while they of course can’t provide support on UPS’ API, they can help you compare the Postman to Zapier calls. But if you’d rather try to piece that together in this forum I can share any non-identifying information from the logs if you make some new calls (looks like all previous calls have rolled off of our logs).

Userlevel 2
Badge +1

Thanks for your reply @shalgrim.  I have had to move this project to the backburner for now.  I got USPS, DHL, and Fedex connections working with very little issue, and I’ve already spent more time getting UPS working than all the other ones combined.  Their support team has been moderately helpful, but is unfamiliar with Zapier.  It seems crazy to me that none of the big shippers would want to have native Zapier connections and instead rely on these 3rd party systems to act at the go-between.  All of them have monthly fees attached for even basic services like tracking.  I appreciate your help and wish there was more UPS could do to facilitate this.

Userlevel 6
Badge +8

Thanks for letting us know! And reach out again if you decide you want to pick it up again