Skip to main content
13-Aquamarine
March 27, 2023
Solved

Connection to IFS Cloud Endpoint with OAuth 2.0

  • March 27, 2023
  • 2 replies
  • 4678 views

Hi PTC Developer team,

I am looking for example code of how to connect to IFS Cloud where I need to use OAuth 2.0 Client from ThingWorx Platform. (I would like to find a way without using ThingWorx Flow) 

 

Steps I like to perform:

1. Connect with OAuth 2.0 from the platform (looking for example code).

2. Extract data using the REST enpoints (this we have already done in postman and will be able to use in TWX when the auth is configured). 

 

Link to IFS Cloud documentation: https://docs.ifs.com/techdocs/22r1/030_administration/010_security/005_security/030_authentication/#bearer_token_usage 

Best answer by MarekP.Nowaczyk

Hi,

I have few suggestions I think will be a good starting point:

1. First you need to have ThingWorx Platform configured for SSO with IdP of your choice so it can request OAuth token for  IFS Cloud application - see Single Sign-on Overview (ptc.com)

2. Next your IFS Cloud Application need to be defined in CAS so ThingWorx can request OAuth token - see authorization examples of SAP and Windchill  here Configuring the Central Auth Server – PingFederate (ptc.com)

3. Then I think will should extend HTTPConnector -see Integration Connectors (ptc.com) and define the service to authenticate using OAuth token and call some rest POINT similarly to what you have done in Postman

 

Hope this helps.

 

Marek

2 replies

17-Peridot
March 27, 2023

Hello,

 

I was wondering, is it your client id, client secret etc that you want to get in step 1?

Or do you have them and just want to know how to use them in a Thingworx REST call?

 

Regards,

Jens

13-Aquamarine
March 27, 2023

I would like to know both. I guess the second part I can figure out from what we have in postman and I guess it's configured in the header. 

17-Peridot
March 27, 2023

Alright, then I am not sure I can help you more than to point you to the IFS community.

Did you check out this IFS community post for example? 

https://community.ifs.com/framework-experience-infrastructure-cloud-integration-dev-tools-50/ifs-rest-api-oauth-2-13375 

 

Looks like there is a link in this post that explains how to do it using postman, and I assume you could probably do the same steps to make it work on Thingworx.

 

Sorry I couldn't be of more help.

 

Regards,

Jens

 

15-Moonstone
April 21, 2023

Hi,

I have few suggestions I think will be a good starting point:

1. First you need to have ThingWorx Platform configured for SSO with IdP of your choice so it can request OAuth token for  IFS Cloud application - see Single Sign-on Overview (ptc.com)

2. Next your IFS Cloud Application need to be defined in CAS so ThingWorx can request OAuth token - see authorization examples of SAP and Windchill  here Configuring the Central Auth Server – PingFederate (ptc.com)

3. Then I think will should extend HTTPConnector -see Integration Connectors (ptc.com) and define the service to authenticate using OAuth token and call some rest POINT similarly to what you have done in Postman

 

Hope this helps.

 

Marek

13-Aquamarine
April 21, 2023

Thanks Marek for your suggestions. Could you please confirm if SSO is required in this scenario? 

15-Moonstone
April 21, 2023

Yes ,ThingWorx has to be configured for SSO to be able to request for OAuth token from CAS. ThingWorx user making such request has to be authenticated with the IdP, you can't request OAuth token as anonymous user.