Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
My goal is simply to log the user out from ThingWorx and redirect to a custom URL. However I've ran in to several issues trying to achieve this.
Official "Logout button" widget:
The main issue is that there is no possibility to redirect to an URL, only to a mashup so this seems like a dead-end.
Customized "Logout button" widget by PTC Labs:
This widget logs out and redirects correctly as long as the url is external. When trying to redirect to a "/Thingworx/*" URL on the same domain the user is never logged out.
Manual solution with REST call:
When making a REST call to "/Thingworx/Server/*/Services/" using the ThingworxInvoker the user is successfully logged out, but a basic authentication prompt is immediately displayed for the user.
Is there a widget, or any way, to simply log the user out and redirect to a specified URL without a basic authentication prompt displaying in Thingworx?
Thanks in advance.
Hi @CMabr.
Please take a look at the following articles for potential solutions to your problem:
Logout Button functionality with redirect link/URL does not work in ThingWorx
How to Logout a user from a Mashup in ThingWorx
Regard.
--Sharon
If my response has answered your question, please mark it as the Accepted Solution, for the benefit of others who may have the same question.
Thanks for the reply. When using REST to invoke Logout or TerminateUserSessions I get a 200 OK response, but the session is still active and the user is not logged out.
If I invoke the same service(s) with the ThingworxInvoker it ends the session correctly, but a basic authentication form is immediately shown afterwards which I'm trying to avoid.
On your third REST method, have you tried: http://<server>/Thingworx/Server/*/Services/Logout?method=post&_redirectURL=<URL>
(set the url, for example, to the form login page)
Otherwise, you may need to look into a custom authenticator. The topic has been discussed here before, please take a look to see if any help:
https://community.ptc.com/t5/ThingWorx-Developers/Redirect-login-to-FormLogin/m-p/506704
Hi @CMabr.
If one of the previous responses helped you to find a solution to your problem, please mark the appropriate one as the Accepted Solution for the benefit of others with the same question.
Regards.
--Sharon