'Twilio Programmable Chat - Access denied (code: 54007) for old chats

We are using Twilio Programmable Chat on our project for 1 year. On the mobile side we use twilio-chat v.6.0.0 SDK. On the backend side we use java library - com.twilio.sdk:twilio:7.51.0

Problem

But a couple of days ago we started experiencing problems with authorization on the mobile side. Everything is ok when we create new chats and work with them.

But when we try to fetch messages for the old chats (created before that problems), we receive the following error access forbidden for identity (status: 403, code: 54007)

What we tried

  • We tried to upgrade/downgrade both mobile SDK and backend libraries.
  • I've read the code: 54007 documentation. We have never configured any Sync services, possible they were introduced and not properly configured for the old chats?
  • We have only one Sync service that was created (automatically) recently and ACL enabled flag is set to false.

Twilio sync service settings

Here is the structure of our access token: Access token structure

My guess is that something has recently been changed with the permissions in the Chat API and the default config is not working for us.

I don't know exactly what it could be. Please, help.



Solution 1:[1]

This is the official answer from Twillio Support that helped us:

Recently the engineering team has effectively deployed some modifications over Programmable Chat; before this change, users would be able to see channel messages that they were not part of. With this update, users will receive error code 54007 for Chat if they try to read any channel that they are not a member of.

Solution 2:[2]

In our case we got the same error when trying to fetch messages for a channel where the user is not a member of Error: Access forbidden for identity (status: 403, code: 54007). This happened with Twilio SDK twilio-chat 6.0.0 and 4.1.0.

After we reviewed the "Roles and Permissions" section in the Twilio Console we noticed that the "service user" (which is the default user role for the chat user) did not have the permission "editChannelAttributes" activated, as compared to another sub account where fetching messages for unjoined channels was still possible.

Activating the permission "editChannelAttributes" for the service user and fetching messages seems to work again.

I'm not sure what the connection between this permission and fetching messages could be, but maybe this information is still helpful.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vld_dlV
Solution 2 stackoverflowjakob