Skip to main content

Our supplier has changed their API and are now using OAuth. I'm struggling to connect, mostly because they are very unhelpful about what is needed in the Header and Body to access the credentials API

 

I have been given this information:

access token URL https://ashridgeidentityserver.azurewebsites.net/connect/token

 

OAuth 2 with Client Credentials

Client ID : AG_WaternetAPIClient

Client Secret : **********

Client Scope : AG_DatabaseAPI

 

And a screenshot from their POSTMAN service.

 

Can anyone help me set up the HTTP Caller? I have added the client secret to a Bearer Token thus far but just get "bad request"

 

 

Ok things that I can see in the screen shot which should help:

 

  1. The POST content type here is not JSON but form-urlencoded (you can use the Multipart / Form Data Upload Data in FME
  2. From the screen shot the "client_type" in the post should be "client_credentials"
  3. Authorization header looks to be "Basic" which means you should just need to provide your username and password in the HTTPCaller using the Basic authentication method (and no need to set the Authorization header).

 

So you should be able to use just your client id and secret here as username and password to generate the token. It's the token which you get back in the response (access_token).

 

imageUsing these settings gave me a {"error":"invalid_client"} response. So seems to work


Ok things that I can see in the screen shot which should help:

 

  1. The POST content type here is not JSON but form-urlencoded (you can use the Multipart / Form Data Upload Data in FME
  2. From the screen shot the "client_type" in the post should be "client_credentials"
  3. Authorization header looks to be "Basic" which means you should just need to provide your username and password in the HTTPCaller using the Basic authentication method (and no need to set the Authorization header).

 

So you should be able to use just your client id and secret here as username and password to generate the token. It's the token which you get back in the response (access_token).

 

imageUsing these settings gave me a {"error":"invalid_client"} response. So seems to work

You'll need to then extract the token from the JSON Response and use it in subsequent requests as the Bearer token in the Authorization header.

 

You can actually use FME to build a web-connection once your comfortable with the process.

 

 


Ok things that I can see in the screen shot which should help:

 

  1. The POST content type here is not JSON but form-urlencoded (you can use the Multipart / Form Data Upload Data in FME
  2. From the screen shot the "client_type" in the post should be "client_credentials"
  3. Authorization header looks to be "Basic" which means you should just need to provide your username and password in the HTTPCaller using the Basic authentication method (and no need to set the Authorization header).

 

So you should be able to use just your client id and secret here as username and password to generate the token. It's the token which you get back in the response (access_token).

 

imageUsing these settings gave me a {"error":"invalid_client"} response. So seems to work

Morning Matt,

Thanks very much - that's a great help. I've added the details but now get the error message "{"error":"unsupported_grant_type"}". Any ideas on that one?

 


Morning Matt,

Thanks very much - that's a great help. I've added the details but now get the error message "{"error":"unsupported_grant_type"}". Any ideas on that one?

 

Oh, interesting - You could try putting the string in quote marks but I assume that FME will handle that but maybe not.

The other thing to try is to submit the post like this:

 

image 

This might be the more appropriate method. Here we are specifically using the same content type here. This might have been the problem. The Upload body here I've just put it in as if it were at the end of the URL. (https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data)

 


Morning Matt,

Thanks very much - that's a great help. I've added the details but now get the error message "{"error":"unsupported_grant_type"}". Any ideas on that one?

 

Thanks for your help Matt. I am still getting errors so will liaise with the supplier. Thanks for helping me make sense of all this!

 

 


Morning Matt,

Thanks very much - that's a great help. I've added the details but now get the error message "{"error":"unsupported_grant_type"}". Any ideas on that one?

 

Hi Matt,

Finally got this to work after a bit of tinkering:

 

imageLooks like the grant_type and scope have to be in the right order, and the user credentials not added to the Body as part of the string.

The article you posted was a great help!

 


Morning Matt,

Thanks very much - that's a great help. I've added the details but now get the error message "{"error":"unsupported_grant_type"}". Any ideas on that one?

 

Awesome, great news. Thanks for the update. Good luck with actually now getting the data!


Morning Matt,

Thanks very much - that's a great help. I've added the details but now get the error message "{"error":"unsupported_grant_type"}". Any ideas on that one?

 

Thanks for the advice sir.

 

 

 

 

 

Thanks for the advice, sir. When I needed assistance with writing My Term Paper, I found TrustMyPaper Their essay writing services were quick and helped me improve and personalize my essay. Highly recommended!


Reply