Oauth2 Token Return

I am new to working with Celigo and seem to have run up against a brick wall trying to get an Oauth2 token to use in making REST API calls. I can make them all work correctly in Postman yet I keep getting errors in Celigo when I "test" the setup. Here is the call that I use to get the token: (values changed...)

https://api.target.us/oauth2/token?client_id=CLIENT-KEY&api_key=API-KEY
This call returns:

{
"token_type": "bearer",
"access_token": "2e77d.47a0479900504cb3ab4a1f626d174d2d"
}
Which I can then take the token and then use it to call REST API calls and return data correctly. In my integration, I have the HTTP call setup first to retrieve the token then a REST call to then handle the data retrieval from the outside API. The "base URI" for the API methods is different: "https://api.target.us/v1" hence both an HTTP connection to get the the token then a REST API once the token has been retrieved. My problem is that it seems no matter how I try and setup the Oauth2 HTTP connection, it always errors out. (Yes I have read and followed the "Setup an Oauth2 HTTP connection..." many times! I continually get a "Bad Request" during testing. Any help would be appreciated.

Hi @paulsiegerist314 -
Thanks for posting this to the community. I'm reaching out to some internal folks to see if someone can assist here. However, you may also want to open a Support ticket.

Thanks,

Kate

Hi Paul,

To debug this issue further can you please provide:

  1. The API doc you're referring to for making the API calls.
  2. Postman screenshots(by hiding the sensitive information like - client ID, API key, etc.,)

Thank you!

Here's a link to the API documentation:
API - Application Program Interface - FastSensor Knowledge Base

Here's the result from Postman:

Thank you Paul for the details.

Can you please try creating a connection in the following way:

  1. Provide your Base URI

  2. Select Auth type as "Token" and provide access_token value from your postman call. Select Send token via, Header name and field as shown below:

  3. Check the "Configure refresh token" checkbox and provide refresh token details. Provide a dummy value in the "Refresh token" and provide method, URL, and path to fetch the token
    Method: POST
    URL: https://api.fastsensor.us/oauth2/token?client_id={{{connection.http.encrypted.client_id}}}&api_key={{{connection.http.encrypted.api_key}}}
    Path to token field in HTTP response body: access_token

  4. Select Method and populate the Relative URL to test the connection

  5. In the "Advanced" section of your connection, save your client_id and api_key in the encrypted.
    {
    "client_id": "replace-with-your-client-id",
    "api_key": "replace-with-your-api-key"
    }

Hope this helps!
Please reach out if you have any further issues.

Thank you!


Srilekha-Tirumala, thank you for the "guide" and it works correctly now! I am guessing that because you added the "POST" in with a fake value that each time the API is called, it will retrieve a new token, so that one does not need to worry about their "timeout" property?

Hi Paul,

Glad to know that the above configuration worked.

Yes, the settings configure under "Configure refresh token" should refresh the token automatically.

Please do let us know if that is not the case. We can assist you further.

Thank you!