我的客户端代码如下所示:
fetchAccessToken { (accessToken: String) in
TwilioVoice.register(withAccessToken: accessToken, deviceToken: deviceToken) { (error) in
if let error = error {
NSLog("An error occurred while registering: \(error.localizedDescription)")
}
else {
NSLog("Successfully registered for VoIP push notifications.")
}
}
}
控制台中的内容如下:
voipTestWithTwilio[2431:517236] [ERROR TwilioVoice] Inside register:deviceToken:completion:, failed to register for Twilio push notifications. Error:Invalid access token signature
voipTestWithTwilio[2431:517236] An error occurred while registering: Invalid access token signature
var grant = new VoiceGrant
{
OutgoingApplicationSid = outgoingApplicationSid
};
var grants = new HashSet<IGrant> { { grant } };
var token = new Token(
accountSid: accountSid,
signingKeySid: apiKey,
secret: apiSecret,
identity: identity,
grants: grants
);
return token.ToJwt();
我一直在网上寻找这个问题,到目前为止没有任何帮助。我试着联系他们,但没有得到任何回应。我还尝试在Twilio上创建新的api键,甚至创建了一个新项目。有人能谈谈这个问题吗?
更新
我将推送通知sid添加到VoiceGrant,现在我得到了
403禁止
在
Twilio error codes page
访问令牌中提供的过期时间超过了允许的最大持续时间。
Token
具有各种值的构造函数,这些值不会改变结果。
这个问题仍然存在。