Skip to Content

Logout not working (SAP Cloud Platform SDK for Android)

Hi Team,

I am unable to registered/remove ID from HCPMS trial account. I registered device using saml based authentication.

I am using (SAP Cloud Platform SDK for Android) Version 2.0 and I am using below code snippet. Please help me.

public void unRegisterLogic() {
String serviceUrl = "https://hcpms-xxxxxxxxtrial.hanatrial.ondemand.com";
try {
CookieManager.getInstance().removeAllCookies(null);
} catch (Exception e) {
e.printStackTrace();
}
Request request = new Request.Builder()
.post(RequestBody.create(null, ""))
.url(serviceUrl + "/mobileservices/sessions/logout")
.build();

Callback updateUICallback = new Callback() {
@Overridepublic void onFailure(@NonNull Call call, final IOException e) {
Log.d("APP", "Log out failed: " + e.getLocalizedMessage());
}

@Overridepublic void onResponse(@NonNull Call call, final Response response) {
if (response.isSuccessful()) {
Log.d("APP", "Successfully logged out");
} else {
Log.d("APP", "Log out failed " + response.networkResponse());
}
}
};
ClientProvider.get().newCall(request).enqueue(updateUICallback);
}

Regards

Ramakrishna.Amathi

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

6 Answers

  • Mar 25 at 06:12 PM
    Add comment
    10|10000 characters needed characters exceeded

  • Mar 26 at 12:24 PM

    Hi Rob,

    I tired above link but i am getting forbidden error.I registered device based on SAML based authentication.

    In HCPMS log getting message "Login with authentication type FORM failed"

    Regards

    Ramakrishna. Amathi


    forbiddenerror.png (25.0 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Jun 07 at 11:55 AM

    Hi Team,

    Please update above comment. I registered device using basic and saml based authentication.

    Regards

    Ramakrishna. Amathi

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 10 at 12:35 PM

    I believe the link Rob was trying to share is

    Delete Application Connection

    The user logout request I believe stops the session between the client and the server rather than removing the ID from Mobile Services.

    If the goal is to periodically clean up unused registrations, one other approach to this would be to use the Automatic Removal feature under the user registrations tab.
    https://help.sap.com/viewer/38dbd9fbb49240f3b4d954e92335e670/Cloud/en-US/35877fbd394344c7885d0f15f9c08df9.html

    Hope that helps,
    Dan van Leeuwen


    Add comment
    10|10000 characters needed characters exceeded

  • Jun 10 at 01:26 PM

    Ok Dan, Let me try once and then update you.

    Regards

    Ramakrishna. Amathi

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 10 at 05:00 PM

    Hi Dan,

    User logout request working fine. It showing message like "User session 894AE285CE80649B3857F6BA2DC59A35A9F292B2BBE3CF1539003205026DAABA successfully terminated" HCPMS logs. But If i use same appcid in rest client/Postman data getting success. Any thing wrong is there in my side.

    Regards

    Ramakrishna. Amathi

    Add comment
    10|10000 characters needed characters exceeded