Skip to main content

Hello,


We have implemented an implicit grant flow in our login authorization flow. However we have come across a problem when trying to logout. (We assume this is also the problem at other platform(). functions). For that function we use the following code:

function logout() {
    rcsdk.platform().logout()
        .then(function (res) {
            _isLoggedIn = false;
            console.log('rcClient logged out');
            rcWebPhone.userAgent.unregister();
            var onLogout = handlers "onLogout"];
            onLogout();
            loginstatus();
            subscriptionCache.resetSubscription();
        })
        .catch(function (res) {
            console.log('An error occurred while logging out rcClient');
        });
}

The catch catches an error with the following message: "Failed to execute 'fetch' on 'Window': Cannot construct a Request with a Request object that has already been used."

The API response is :

{
  "error" : "invalid_client",
  "errors" : / {
    "errorCode" : "OAU-153",
    "message" : "Invalid client: ${client_id}"
  } ],
  "error_description" : "Invalid client: ${client_id}"
}


WE cannot pinpoint why it would say it is an invalid client_id because we can use other apicalls before the logout just fine.

I will add also the way we login to be complete in my information:

function show3LeggedLogin() {
    redirectUri = decodeURIComponent(window.location.href.split('rcclient.html', 1) + 'callback.html');
    console.log('Redirect uri: ', redirectUri);
    rcsdk = new SDK({
        appKey: appKey,
        server: server,
        redirectUri: redirectUri
    });
    platform = rcsdk.platform();
    var loginUrl = platform.loginUrl({ implicit: true });
    platform
        .loginWindow({ url: loginUrl }) // this method also allows to supply more options to control window position
        .then(function (loginOptions) {
            return platform.login(loginOptions);
        })
        .then(function (res) {
            // Login success
            return postLogin();
        })
        .catch(function (e) {
            // Login failed
            console.error(e.stack || e);
            var handleLoginFailed = handlersi"loginFailed"];
            handleLoginFailed();
        });
}


I hope you can help us or at least steer us in the right direction to solve this. If you need more information please say so!


With kind regards,

Martijn (logged in under Jeroens name)

Be the first to reply!

Reply