cancel
Showing results for 
Search instead for 
Did you mean: 

Logoff from identity provider in sapui5 application in Sap cloud platform

Hello All,

I am using one identity provider for login service in Sap ui5 app in SCP. But, when iam trying to logout from the ui5 app, it is directly redirecting again to app without asking user credentials. I have tried the following approaches but they didn't work.

1) Maintaining logout Page in neo-app.json so that SCP will automatically take care of logout behavior- didn't work.

2) Tried with logout endpoint in user api service - didn't work.

3) Used below method (only from clear authentication Cache process and modifying url link to SAP CLOUD PLATFORM odata Services)-- didn't work.

Could you please provide your help here.

Thank you.

former_member540067
Active Participant
0 Kudos

Are you testing it from WEB IDE or deployed cloud application?

0 Kudos

I am testing the deployed application. I am also testing from web ide and it seems working fine in webide except that it is not displaying logout.html page and directly giving 503 error.

In deployed cloud app, it is displaying the logout page, but when I click log in again, it is directly starting the app without asking for credentials.

Accepted Solutions (1)

Accepted Solutions (1)

former_member540067
Active Participant

Use the following Approach:

1. Maintain the logout.html page in under webapp folder.

<!DOCTYPE HTML>
<html>
    <head>
        <script type="text/javascript">
          window.location.href = "./index.html"
        </script>
        <title>Page Redirection</title>
    </head>
    <body>
        <h4>Logging out...</h4>
    </body>
</html>

2. in neo-app.json, mention:

"logoutPage": "/logout.html",

3. In Controller, on the event, trigger logout page (Assuming your controller is also under controller folder in webapp folder):

sap.m.URLHelper.redirect("/logout.html", false);

Regards

Anmol

0 Kudos

Hi Anmol,

I have tried the above approach. Still, it is directly logging into the app after the logout page. I want to manually enter the credentials again when the user logs off.

Below is my logoff screen. when the user clicks on 'Log back on' button, it should redirect to IDP Providers login page. Yes, logout.html is under webapp folder only.

former_member540067
Active Participant
0 Kudos

Strange. Working absolutely fine for me. You are using standalone app only? It is not on the Portal site right?

In my case, it is logging out and asking for the credentials again.

0 Kudos

Yes. I am using standalone app only. No idea on why it is not working. Exploring the web to find any other solutions.

former_member540067
Active Participant
0 Kudos

Can you share the snippet of your project structure, neoapp and controller code.

former_member540067
Active Participant
0 Kudos

Also please share the network trace with logs preserved.

0 Kudos

I have attached them in answer section. Please check

former_member599006
Participant
0 Kudos

Hi Anmol,

I tried the same in Cloud Foundry, it is navigating to logout page, but the session is not killed, please help.

Regards,
VM Kumar

Answers (1)

Answers (1)

0 Kudos

Hi Anmol.

PFB Screenshots.

Ok..PFB

Thanks

former_member540067
Active Participant
0 Kudos

For a test purpose, can you try replacing your logout.html code with my given code once. I think there might be some issue with it. Secondly is it a HAT application? I can see the mobile folder in the project structure.

0 Kudos

Yes. I have tried with the logout file you have. Still the behavior is same. Now, when click logout, it is directly starting the app as we have modified window.href

Yes. It is hybrid app. We are implementing app logout part separately.

0 Kudos

Hi Anmol,

It is working now after deploying to cloud platform but not working when testing with webide.Not sure on why.

It is working fine with both the logout files(Your's and mine).

Thanks for your support here. Anything to say on not working in webide part?

former_member540067
Active Participant
0 Kudos

Yes it won't work in webide because the path of logout file in webide is in webapp folder. If you want to make it work in webide, you need to mention the path with /webapp/ but as per the scenario, we will be using the deployed app in the production environment, not in webide.

Hope it helps.

Please upvote and mark the answer as correct if it helped.

Regards

Anmol

0 Kudos

ok. Thank you. I have tried replacing with /webapp/logout.html and tested in webide. Still, it is directly redirecting into app.

former_member540067
Active Participant
0 Kudos

Oh. Let me see in the morning. I will let you know then.

former_member540067
Active Participant
0 Kudos

Give a try by removing /webapp from neo-app only.

0 Kudos

Maybe this will help: sap.ushell.Container.logout();