question

Jeroen Couwenberg avatar image
Jeroen Couwenberg asked ·

Ringcentral returns OAU-153 response

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 = handlers["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)

errorresponseimplicit grant flowoau-153
1 comment
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Just a quick check. Can you double check the rcsdk.platform() instance inside the logout function to see if it is instantiated? I guessed the rcsdk is a global variable but not sure how you implemented it.

0 Likes 0 · ·

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.