API Connection

Status
Not open for further replies.

james_tech

Silver Partner
Joined
Jun 7, 2022
Messages
37
Reaction score
2
Hi there,

I am wanting to setup an integration to HaloPSA via CFDs, but I am unsure of how to get the token for OAuth2.0. Is there a step that I am missing, not sure where to put the API url and AUTH URL. Please can someone assist?

1690283678020.png

I'd like to have it so that it prompts for a ticket ID on the phone, then transfer to the assigned agent.
 
Hello,

First, please note that using OAuth2 from a CFD app can be challenging, so if your CRM supports a different way of authentication, then maybe that would be preferred.

OAuth2 requires several steps:
1) You need to authorize the app. This is usually a manual procedure. You need to open the authorization endpoint in your browser, grant access, and this will give you an "authorization code".
2) With this authorization code, you need to invoke the token endpoint, in order to get a refresh token.
3) Once you have the long live refresh token, you use it to get a short live access token, using the token endpoint.
4) You use the access token in the authorization header of your HTTP requests to the API.

So, points 1 and 2 are something that you will need to do from outside the CFD app. For the first point, you will need to do this from the browser. For the second point, you can use Postman for example, to send the POST request to the token endpoint.

Then, from the app, you will need to use an HTTP Requests component to execute the step 3, for example when the call starts. Here you will hardcode the refresh token obtained in step 2, and you will use it to get the access token. In order to parse the JSON response and get the access token, you can use the JSON / XML Parser component.

Finally, you can use the Web Service REST component for all your API calls. For this, you will use the access token obtained just before, you can set it in this component by selecting the variable that has the access token in your CFD app.
 
  • Like
Reactions: Evolute IT
Hello,

First, please note that using OAuth2 from a CFD app can be challenging, so if your CRM supports a different way of authentication, then maybe that would be preferred.

OAuth2 requires several steps:
1) You need to authorize the app. This is usually a manual procedure. You need to open the authorization endpoint in your browser, grant access, and this will give you an "authorization code".
2) With this authorization code, you need to invoke the token endpoint, in order to get a refresh token.
3) Once you have the long live refresh token, you use it to get a short live access token, using the token endpoint.
4) You use the access token in the authorization header of your HTTP requests to the API.

So, points 1 and 2 are something that you will need to do from outside the CFD app. For the first point, you will need to do this from the browser. For the second point, you can use Postman for example, to send the POST request to the token endpoint.

Then, from the app, you will need to use an HTTP Requests component to execute the step 3, for example when the call starts. Here you will hardcode the refresh token obtained in step 2, and you will use it to get the access token. In order to parse the JSON response and get the access token, you can use the JSON / XML Parser component.

Finally, you can use the Web Service REST component for all your API calls. For this, you will use the access token obtained just before, you can set it in this component by selecting the variable that has the access token in your CFD app.
Hi!

Thanks for your reply :)

I've had a look, and there are other methods but I do not think they will work?

1692113313135.png

1692113322022.png

Do you have a working example of what data to configure in these areas? I set it up on FreshDesk many years ago, but I cannot remember how it was done :( think it was a lot easier than HaloPSA! haha

1692113359836.png
 
Well, this depends on the API. From what you pasted, you need an initial request including your user name, password and client ID, to get a pair of tokens back. Then you should use the access token to authorize your requests. And you could store the refresh token somewhere to use it in the future to ask for more access tokens once they expire. This is pretty much the same as OAuth2, a small variant actually. But I can't tell the details without reading the API documentation. As I mentioned, using OAuth2 from a CFD app can be quite challenging, if you don't feel capable of doing this by yourself maybe you should hire a 3CX partner to do this for you.
 
Status
Not open for further replies.

Members Online Now

Forum statistics

Threads
111,843
Messages
589,328
Members
164,680
Latest member
JV J