Closed ebaek closed 4 years ago
Hi @ebaek,
Thank you for opening an issue. I will update the capitalization and I've forwarded your question about logout to a developer on the team. Either myself or they will reach out with an answer as soon as we can.
Please don't hesitate to open more issues or provide general feedback in the future as you work with the service so that we can continue to improve the experience.
Hey @smguilia @ebaek ,
Actually it should not be capitalized. The way it's written is the correct way to call the logout function, it's a method of an instance of WebAppStrategy
, in all of our samples we refer to that by webAppStrategy
.
@ebaek What error did you get?
https://github.com/ibm-cloud-security/appid-serversdk-nodejs/blob/master/lib/strategies/webapp-strategy.js#L554
Hi @TalAviel @smguilia,
Thanks for getting back to me! In the Node.js documentation under quick start guide (https://cloud.ibm.com/docs/services/appid?topic=appid-web-node) and the Web apps guide under securing your Apps (https://cloud.ibm.com/docs/services/appid?topic=appid-web-apps), the instance of WebAppStrategy is referred to as const WebAppStrategy = require("ibmcloud-appid").WebAppStrategy;
- perhaps for clarity all the samples should be consistent?
This is the error I get when I invoke WebAppStrategy.logoutSSO(). SSO is enabled on the App ID service and while WebAppStrategy.logout() works, WebAppStrategy.logoutSSO() does not.
Hey @ebaek , we'll update the docs to make it more clear, thanks.
In the code snippet you shared, WebAppStrategy
is the class. The logoutSSO
is a method as you can see in the GitHub repository I shared with you. Meaning, you have to create an instance of WebAppStrategy
in order to call that method.
Like -
let webAppStrategy = new WebAppStrategy(.....);
....
webAppStrategy.logoutSSO();
Thanks,
@TalAviel Ah gotcha- thanks so much!
https://cloud.ibm.com/docs/services/appid?topic=appid-cd-sso#cd-sso-log-out
Under the "By Using the Node.js Server SDK" header, the docs read as follows:
app.get('/logoutSSO', (req, res) => { res.clearCookie("refreshToken"); webAppStrategy.logoutSSO(req,res, { "redirect_uri": "https://my-app.com/after_logout" }); });