I'm using the TwilioConversationsClient
on iOS. How do I generate a new token once my existing token has expired?
These delegate methods get called after the token expires.
- (void)conversationsClientTokenWillExpire:(TwilioConversationsClient *)client
{
}
- (void)conversationsClientTokenExpired:(TwilioConversationsClient *)client
{
}
I know I'm supposed to call this method to update the token for the client, but I don't understand how to generate a new token for an existing conversation using the iOS SDK.
[client updateToken:@"TOKEN" completion:^(TCHResult * _Nonnull result) {
}];
Twilio developer evangelist here.
There is no way to generate a token from within the iOS SDK. Generating tokens requires your API secret and that should never be a part of the client-side code.
Instead, when the conversationsClientTokenWillExpire
delegate method is called, you should make another request to your Node.js server to generate a new token. Once you have the new token, call updateToken
on your Conversations Client and it will continue to work.