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
Adding app credentials in production isn't working
Tags: credentials
Jan 6, 2023 at 11:29am   •   2 replies  •  0 likes
Manager Desk

I've added additional credentials to an active app, but still hitting an error that I don't have the credentials. Is there anything I need to do?


If this needs to be tested in sandbox first, my sandbox credentials in the portal are all set to N/A - if this is the case, what are the next steps to do to fix this?

on Jan 6, 2023 at 11:52am   •  0 likes

Please clarify what do you mean "add additional credentials to an active app"?

on Jan 6, 2023 at 12:03pm   •  0 likes

I mean I have an app that is in production. I need to add additional permissions on the app, for example, accessing call recordings, reading, messages etc.permissions on the app, for example, accessing call recordings, reading, messages etc. I've added them in the app settings where you set the app permissions, but it doesn’t seem to work.

1 Answer
answered on Jan 6, 2023 at 1:02pm  

Using code flow. I've added them about 3 hours ago. It's not working.

I'm no getting the message property in the records object that is returned from the /call-log endpoint as described here:

https://developers.ringcentral.com/api-reference/Call-Log/readUserCallLog


I'm assuming it's because the permissions aren't updated?


 0
answered on Jan 6, 2023 at 12:49pm  

So app permissions are not app credentials!

Your app must be a private app and that is why you can add/remove app permissions to the app even after the app is graduated to the production. This is a new feature and I think it should work.

How long time did you call new APIs from your app after the app was updated with new permission?

What is the auth mode of your app? JWT or password flow or code flow? In any auth mode, you need to get a new access token that would work with new app permissions.


 0
on Jan 6, 2023 at 1:02pm   •  0 likes

Using code flow. I've added them about 3 hours ago. It's not working.

I'm no getting the message property in the records object that is returned from the /call-log endpoint as described here:

https://developers.ringcentral.com/api-reference/Call-Log/readUserCallLog


I'm assuming it's because the permissions aren't updated?

on Jan 6, 2023 at 1:07pm   •  0 likes

Added the read messages and read call recordings as shown here:


screen-shot-2023-01-06-at-10606-pm.png


on Jan 6, 2023 at 1:37pm   •  0 likes

What is the app client id?

on Jan 6, 2023 at 1:47pm   •  0 likes

60PkEonZSPm9PKvnCGQIOQ

on Jan 6, 2023 at 2:29pm   •  0 likes

Your app auth method is not code flow. It is password flow auth.

I see the app got suspended and reactive today around 11AM?

Show me the code how you login (remove sensitive info) and what API do you call and if possible, what error do you receive.

on Jan 6, 2023 at 2:40pm   •  0 likes

This is the code. I am expecting to see the message property so I can take the recording id and the pull it. As mentioned, the message property is non existent.


async function getAuthToken() {
    const tokenResponse = await axios.post(`${RINGCENTRAL_SERVER}/restapi/oauth/token`,
        `grant_type=password&username=${username}&password=${password}&extensionNumber=101`,
        {
            auth: {
                username: clientId,
                password: clientSecret
            },
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        }
    );
    return tokenResponse.data.access_token;
}

async function getCallLogWithPagination(dateFrom, dateTo, accessToken) {
    let callLog = [];
    let nextPageUri = `${RINGCENTRAL_SERVER}/restapi/v1.0/account/~/call-log?dateFrom=${dateFrom}&dateTo=${dateTo}`;

    while (nextPageUri) {
        const callLogResponse = await axios.get(nextPageUri, {
            headers: {
                'Authorization': `Bearer ${accessToken}`
            }
        });
        callLog = callLog.concat(callLogResponse.data.records);
        nextPageUri = callLogResponse.data.navigation.nextPage ? callLogResponse.data.navigation.nextPage.uri : null;
    }

    return callLog;
}

async function main() {
    const accessToken = await getAuthToken();
    const dateRange = getDateRange();
    let callLog = await getCallLogWithPagination(dateRange.dateFrom, dateRange.dateTo, accessToken);
    console.log(callLog);
}

main();
on Jan 6, 2023 at 2:53pm   •  0 likes

I don't think that your code ever worked before you add new permissions.

I don't know what you meant "the message property is non existent."

And I don't think that your auth function getAuthToken() work at all because I don't see you set the Authorization header.

Read this dev guide and try one of the example with your app and user credentials before using your own code.

on Jan 6, 2023 at 3:05pm   •  0 likes

This code works, including the auth. Before I've added the other to permissions, I've had only "read call log" and everything worked.

I'm getting back this structure:

  {
    uri: 'https://platform.ringcentral.com/restapi/v1.0/account/**',
    id: 'UsiO4aIbz3POzUA',
    sessionId: '1000790262012',
    startTime: '2023-01-06T13:01:57.040Z',
    duration: 39,
    durationMs: 39338,
    type: 'Voice',
    internalType: 'LocalNumber',
    direction: 'Inbound',
    action: 'Phone Call',
    result: 'Voicemail',
    to: { phoneNumber: '+**' },
    from: {
      name: 'John Smith',
      phoneNumber: '+1**',
      location: 'El Cajon, CA'
    },
    telephonySessionId: 's-a0d7b2a21cb58z185872c7998z40a90400000'
  },


According to this:

https://developers.ringcentral.com/api-reference/Call-Log/readUserCallLog

There is supposed to be a "message" property in this returned object, which is non existent.


Again, my code is authenticating properly and able to pull call log records.

on Jan 6, 2023 at 3:11pm   •  0 likes

For your reference - from the documentation I mentioned.


screen-shot-2023-01-06-at-31058-pm.png

on Jan 9, 2023 at 8:26am   •  0 likes

I don't know what could be wrong. I have never faced or heard such a problem and I helped many developers to add more app permissions to their app and the app would work as expected.

Let's fast forward this problem. Can you create a new app with all the new app permissions in the sandbox and give me the new app client id so I can help to graduate it to the production so you can try the new app.

on Jan 9, 2023 at 4:00pm   •  0 likes

New App client ID (Sandbox):

fxBFOFFZTB-ZedzMY8Q8GA


Thanks.

on Jan 9, 2023 at 4:38pm   •  0 likes

Done! Remember to grab the new app client id and client secret.

on Jan 9, 2023 at 6:18pm   •  0 likes

Thanks - however I'm still seeing the same behavior. Perhaps the endpoint response schema has changed? How would I get the referenced message property?

on Jan 10, 2023 at 8:29am   •  0 likes

You are right. It seems the message object is missing from the response body first level. I will check with the team to see if it is a change or what.

Meanwhile, set the view=Detailed to get the message object under one of the leg objects.

?dateFrom=${dateFrom}&dateTo=${dateTo}&view=Detailed`;
on Jan 10, 2023 at 10:06am   •  0 likes

Just to confirm with you that there is no change in the schema. The first level of the response body is the master leg. And if the voicemail/fax belong to the first leg (master leg), the "message" object would be present in the first level of the response. Otherwise, the message object will be present in a leg under the "legs" array.

So the conclusion is that you should always set the view=Detailed if you expect to see the message object.



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