Has anyone implemented a logout system for the ArcGIS Portal credentials in their web app builder app?
Solved! Go to Solution.
As @akshay loya stated above, https://www.ascentdatamanager.com/arcgis/sharing/rest/oauth2/signoutwill sign the user out while showing a signout confirmation page at the same time.
In order not to display the signout conformation page, use the following code inside the Signout event:
var oReq = new XMLHttpRequest();
oReq.open("get", "https://www.ascentdatamanager.com/arcgis/sharing/rest/oauth2/signout", false);
oReq.setRequestHeader('Content-Type', 'text/xml');// this is required for Google Chrome
oReq.send();
Reference: javascript - Calling client side URL from browser without opening new page - Stack Overflow
This is just a nice workaound. Why the sign out function in the web appbuilder does not work, don't know yet.
Akshay,
I have never thought that there is a need for that. What is you reasoning for wanting it?
Well. I have multiple application running on portal which I've customized using the web app builder and they're using portal credential to login. We create groups on portal depending upon the project need and share the maps with them. There is possibility of multiple users using the application on a system. In that case I would want my user to logout from application itself(Who is obviously not aware of portal).
Akshay,
What theme are you using? If you are using a theme that has the HeaderController widget then you can programatically call the Header Controller Widgets _onSignoutClick function to sign out. If not then you can look at that code to see that you can use the tokenUtils call and call tokenUtils.signOutAll method.
I tried this but seems to be not working for me then I had to use this link instead
https://www.ascentdatamanager.com/arcgis/sharing/rest/oauth2/signout
which takes me to other page, which is bit annoying.
Has anybody got it worked? I am having the same issue. The sign out function in the web appbuilder cannot sign out the user, as after the signout function (widget) is executed, in the web browser when navigating to the Portal page, the user is still signed in!
As @akshay loya stated above, https://www.ascentdatamanager.com/arcgis/sharing/rest/oauth2/signoutwill sign the user out while showing a signout confirmation page at the same time.
In order not to display the signout conformation page, use the following code inside the Signout event:
var oReq = new XMLHttpRequest();
oReq.open("get", "https://www.ascentdatamanager.com/arcgis/sharing/rest/oauth2/signout", false);
oReq.setRequestHeader('Content-Type', 'text/xml');// this is required for Google Chrome
oReq.send();
Reference: javascript - Calling client side URL from browser without opening new page - Stack Overflow
This is just a nice workaound. Why the sign out function in the web appbuilder does not work, don't know yet.
I found a really good workaround.
Add a link, title it "logout" and link to https://arcgis.com/home/pages/Account/manage_accounts.html#client_id=arcgisonline&signout=true
Is there a similar workaround for loging a user out of a AGOL hosted Web application Builder App?