Код: Выделить всё
def generate_chat_token(self, identity, service_sid):
"""
Generate a jwt chat token.
"""
# Get a token.
token = AccessToken(self.account_sid, self.api_key, self.api_secret, identity=identity)
# Add a chat grant to the token.
grant = ChatGrant(service_sid=service_sid)
token.add_grant(grant)
return token.to_jwt()
Код: Выделить всё
let client = await Twilio.Chat.Client.create(token);
Код: Выделить всё
let channel = await client.getChannelBySid('CHXXXX');
Код: Выделить всё
twilio-chat.min.js:171 Uncaught (in promise) Error: Forbidden
at t (twilio-chat.min.js:171)
at t (twilio-chat.min.js:171)
at new t (twilio-chat.min.js:171)
at e. (twilio-chat.min.js:171)
at k (twilio-chat.min.js:171)
at Generator._invoke (twilio-chat.min.js:171)
at Generator.e. [as next] (twilio-chat.min.js:171)
at n (twilio-chat.min.js:127)
at twilio-chat.min.js:127
Код: Выделить всё
def get_conversations(self):
"""
Get Twilio conversations.
"""
return self.client.conversations.conversations.list()
Я не знаю, как это исправить дальше. Как мне получить конкретный канал от клиента без этой ошибки?
Подробнее здесь: https://stackoverflow.com/questions/603 ... -forbidden
Мобильная версия