twilio / voice-quickstart-android

Quickstart app for the Voice Android SDK
https://www.twilio.com/docs/api/voice-sdk/android/getting-started
MIT License
184 stars 140 forks source link

com.twilio.voice.AccessTokenParseException: Access token must have 3 or 5 segments #528

Closed praveenb closed 2 years ago

praveenb commented 2 years ago

Description

Getting below error

W/System.err: com.twilio.voice.AccessTokenParseException: Access token must have 3 or 5 segments

Plese need help on it.

Thank you

Steps to Reproduce

  1. Just changed generated AccesssToken in VoiceActivity file, as per given steps.

[What actually happens] When clicked on Call button, It showing Call Error: 20101, Invalid Access Token

Twilio Call SID(s)

You can find the Call SID in the SDK using Call.getSid() or CallInvite.getCallSid(). The Call SID can also be found on the Twilio Calls Console: https://www.twilio.com/console/voice/calls/logs.

Logs

// Log output when the issue occurs

W/System.err: com.twilio.voice.AccessTokenParseException: Access token must have 3 or 5 segments W/System.err: at com.twilio.voice.AccessTokenParser.parse(AccessTokenParser.java:40) W/System.err: at com.twilio.voice.AccessTokenParser.(AccessTokenParser.java:27) W/System.err: at com.twilio.voice.EventPublisher.(EventPublisher.java:114) W/System.err: at com.twilio.voice.Call.(Call.java:1008) W/System.err: at com.twilio.voice.Voice.connect(Voice.java:616) W/System.err: at com.twilio.examplecustomaudiodevice.CustomDeviceActivity.lambda$callClickListener$0$com-twilio-examplecustomaudiodevice-CustomDeviceActivity(CustomDeviceActivity.java:268) W/System.err: at com.twilio.examplecustomaudiodevice.CustomDeviceActivity$$ExternalSyntheticLambda0.onClick(Unknown Source:2) W/System.err: at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:177) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:107) W/System.err: at android.os.Looper.loop(Looper.java:221) W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7542) W/System.err: at java.lang.reflect.Method.invoke(Native Method) W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

Versions

All relevant version information for the issue.

Voice Android SDK

com.twilio:voice-android:6.1.1 com.twilio:audioswitch:1.1.4

OS Version

Android 10 device

Device Model

Redmi Note

praveenb commented 2 years ago

I see we should change accessToken in CustomDeviceActivity file. Solved the issue.

Which is misssing in QuickStart guide.

Please update the guide. Thank you.