News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Ringcentral returns OAU-153 response
Tags: sdk
Aug 20, 2019 at 5:13am   •   1 replies  •  0 likes
Jeroen Couwenberg

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)



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us