songz / cordova-plugin-opentok

Cordova Plugin for OpenTok - add webrtc video to your iOS or Android App
Other
162 stars 270 forks source link

Validate token request failed #140

Open laurilehmijoki opened 9 years ago

laurilehmijoki commented 9 years ago

Hello. I'm seeing the following error when I'm running the example application of this plugin on Android:

D/opentok-jni( 7648): ot_session_create
D/opentok-native( 7648): [INFO] jni/../src/ot_websvc_xml.c:451: ot_websvc_xml_on_message_complete: Received 165 bytes of XML data from http://www.tokbox.com:80/opentok/assets/xml/iosversion.xml:
D/opentok-native( 7648): <?xml version="1.0"?>
D/opentok-native( 7648): <ios_sdk_version>
D/opentok-native( 7648):   <current_version>20120316152410</current_version>
D/opentok-native( 7648):   <required_version>20120316152410</required_version>
D/opentok-native( 7648): </ios_sdk_version>
D/opentok-native( 7648): [INFO] jni/../src/ot_websvc_xml.c:451: ot_websvc_xml_on_message_complete: Received 285 bytes of XML data from http://anvil.opentok.com:443/session/45136292?extended=true:
D/opentok-native( 7648): <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sessions><Session><error code="403"><errorMessage message="Invalid token. Make sure you're using the latest OpenTok server SDK (http://tokbox.com/opentok/libraries/server). Token: &quot;null&quot;."/></error></Session></sessions>
D/opentok-native( 7648): [INFO] jni/../src/ot_websvc_xml.c:451: ot_websvc_xml_on_message_complete: Received 307 bytes of XML data from http://anvil.opentok.com:443/token/validate:
D/opentok-native( 7648): <?xml version="1.0" encoding="UTF-8" standalone="yes"?><tokens><token><create_time>0</create_time><expire_time>0</expire_time><issuerType>partner</issuerType><invalid>Invalid token. Make sure you're using the latest OpenTok server SDK (http://tokbox.com/opentok/libraries/server).</invalid></token></tokens>
D/opentok-native( 7648): [ERROR] jni/../src/ot_messenger_v1.c:2253: errno: None ot_messenger_v1_on_validate_token_info failed.
D/opentok-native( 7648): [ERROR] jni/../src/ot_messenger_v1.c:2291: errno: None Failed to obtain validate token and/or session info from server.
D/opentok-jni( 7648): --------------------my_on_session_error 1 Validate token request failed.

I don't know where to look further. Any suggestions?

If I base64-decode the token, it contains data such as partner_id and session_id.

aullman commented 9 years ago

Does your token start with "T1==" ?

laurilehmijoki commented 9 years ago

My problem was that I was using an outdated version if this Cordova plugin. The Apache Cordova plugin repository gave me a version 1 one; when I installed this plugin from GitHub, I received a version 2.

In short, upgrading to v2 fixed my problem.

We probably should add the v2 into Apache Cordova plugin repository.