cancel
Showing results for 
Search instead for 
Did you mean: 

OpenUI5 webapp, how to logoff from local odataV2 service.

JakubG_2024
Explorer
176

Dear everyone,

I'm creating my first web application in OpenUI5, and have encountered a wall in the form of logging out of the application. Currently, I am automatically logged out when I close the browser or manually clear session cookies in the browser.
I have tried to do the same with a function that works and clears the cookies, but when I refresh the page the cookies come back and I am still logged in.

I connect to the local server using ‘ui5-middleware-simpleproxy’. And everything is working locally.

I have also tried the option with <localServer:host>/sap/public/bc/icf/logoff

After entering the clink, I get a lovely logout message, but, when I try to enter the server, I am still logged in.

I would really appreciate your help on how to implement logging out of the application. I must admit that I am running out of ideas. Maybe my backend team should do something about it?

Ps: The login option is working in the element I created, only I am annoyed by the pop-up that prompts me to login. Is there any way to remove it?

When I'm login, I use this path:
<localServer:host>/sap/opu/odata/SAP/SERVICE_NAME

Many thanks for help!

View Entire Topic
Noel_Hendrikx
Active Contributor

Hi Jakub,

Why would you try to logout? Any particular reason? If you have your app open, there should be a connection, right?

If you need this for switching users, I'd say have a look at Chrome profiles. You can create multiple users for testing purpose, without closing your application.

So what is your use case to logoff?

Regards,

Noël

JakubG_2024
Explorer
0 Kudos

Hi Noel,

I just woudl like to have that kind of option. Maybe it's my habit from programming React apps. I just think it's a nice option, and now every webapp shodul have that option.

So, to be sure, this is not possible and that I should use the change of profiles on the browser but simply switch it off?

Best regards,

Noel_Hendrikx
Active Contributor
0 Kudos

Nice to see you try our UI5 platform as well as a React developer!

Do you have a standard application or do you use the launchpad functionality as well?

If you are using the launchpad also, you could trigger a logout sap.ushell.Container.logout()

Maybe you can invalidate your session somehow. It is stored in your session cookies indeed. 

(https://www.npmjs.com/package/ui5-middleware-simpleproxy)

I have never seen this use case in UI5 to be honest 🙂

 

JakubG_2024
Explorer
Standard webapp, build with easy ui5 generator.
JakubG_2024
Explorer
0 Kudos
I've tried this method but when I fetch: <localServer:host>/sap/public/bc/icf/logoff, and clean cookies I get information about logoff on the screen but when I refresh the page I'm still logged in.
Noel_Hendrikx
Active Contributor
0 Kudos
The middleware simple proxy is using Express. Check out https://github.com/ui5-community/ui5-ecosystem-showcase/issues and maybe raise a question there.
JakubG_2024
Explorer
0 Kudos
thank you, I will! Have a nice day 🙂