Closed navaranjithavelladurai closed 5 years ago
Kindly give some suggestion its urgent, let you know me what i did wrong
Hi @navaranjithavelladurai
It's hard to tell what exact is causing the error with seeing the access token but basically the operation failed because the Access Token is invalid (either the format is wrong or the credentials are incorrect) and caused the authentication to fail.
Please check your Access Token in https://jwt.io/ and make sure you have all the credentials in it. You should see something like this:
{
"iss": "SKdeadbeedeadbeedeadbeedeadbeedead",
"grants": {
"voice": {
"outgoing": {
"application_sid": "APdeadbeedeadbeedeadbeedeadbeedead"
},
"push_credential_sid": "CRdeadbeedeadbeedeadbeedeadbeedead"
},
"identity": "alice"
},
"sub": "ACdeadbeedeadbeedeadbeedeadbeedead",
"exp": 1556641693,
"nbf": 1556555293
}
-bobie
No same crediential is working fine in android studio, but iOS only facing the issues
Hi @navaranjithavelladurai
The 20101 Invalid Access Token
error indicates that either the format of the Access Token is invalid or the credentials or the identity in the token are invalid. Could you please check the contents of the Access Token?
Thanks, -bobie
Here i formed & get the access token
let baseURLString = "https://xxxxxxx" //let accessTokenEndpoint = "/accessToken" let identity = "alice" let twimlParamTo = "to"
Hi @navaranjithavelladurai
Thanks for providing the code snippet. Please check the credentials in the Access Token generated from this URL are correct. I have a feeling that the Access Token string you received in the iOS application is in incorrect format since the Access Token should not have platform (Android/iOS) dependencies except for the Push Credential SIDs.
-bobie
could you please provide the dummy Access Token for test case purpose?
Hi @navaranjithavelladurai
A random string like ACCESS_TOKEN
should give you the error. Please make sure the Access Token is valid when calling the SDK methods.
-bobie
yah offcourse i tried to put the access token in https://jwt.io/ means, & its shows valid access token.
Hi @navaranjithavelladurai
Please paste the contents (but mask your credentials) of the payload parsed from your Access Token.
-bobie
Kindly check the below contents Header { "typ": "JWT", "alg": "HS384", "cty": "twilio-fpa;v=1" }
Payload { "jti": "xxxxxx", "iss": "xxxxx", "sub": "xxxx", "exp": 1556789315, "grants": { "voice": { "outgoing": { "application_sid": "xxxxxx" } } } }
Verified signature HMACSHA384( base64UrlEncode(header) + "." + base64UrlEncode(payload),
your-256-bit-secret
) secret base64 encoded
Hi @navaranjithavelladurai
Assuming the masked credentials are correct (including the secret of the API Key), you would probably want to check if the identity
is properly specified in the Access Token.
I passed my identity as: let baseURLString = "https://xxxxx" //let accessTokenEndpoint = "/accessToken" let identity = "alice" let twimlParamTo = "to"
Here i formed the baseUrl : guard let accessTokenURL = URL(string: baseURLString) else { return nil } return try? String.init(contentsOf: accessTokenURL, encoding: .utf8)
Here i get the response: let connectOptions: TVOConnectOptions = TVOConnectOptions(accessToken: accessToken) { (builder) in builder.params = [twimlParamTo : "+91xxxxxxxx"] //builder.uuid = uuid print(accessToken) } call = TwilioVoice.connect(with: connectOptions, delegate: self)
Kindly give the suggestion, if i need to do change anything in the above code
Hi @navaranjithavelladurai
Thanks for providing the snippet. Not sure if I am missing something but can you explain how where is the accessToken
variable being updated and assigned? and what contents are you seeing after the token is parsed by https://jwt.io ?
If you think the contents of the token does match the format in my previous comment and the credentials are all correct, please go to Twilio Support and create a support ticket. There you can provide us the Access Token safely and we can help you debug. Please also tag the link of this issue in the support ticket so the support representative person knows which team they need to reach out to.
Thanks, -bobie
Okay thank you for support & time & i created a tickets in Twilio support as per your above comment, Kindly check it please.
Hi @navaranjithavelladurai
I am assuming that the authentication problem has been resolved and things are working on your end. Closing the ticket for now but feel free to reach out to us if you run into any issue in the future.
Thanks, -bobie
Im facing this below issue, i used twilio for the purpose of voice call & i updated my pod file to 'TwilioVoice', '~> 3.0'
Here i'am using the below function to make a call