The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.
Checkout PTC Flow:
"
ThingWorx Flow is what you are looking for.
Configuring & loading OAuth in ThingWorx Flow
"
This is how it is best practice to implement it.
I have a similar issue but currently looking for a way implementing it without using PTC Flow check my question here: https://community.ptc.com/t5/ThingWorx-Developers/ThingWorx-Platform-Connection-to-Saleforce-Endpoint-with-OAuth-2/m-p/681085#M47083