I'm writing a client for the JSON pandora unofficial API and get error code 0 when I try and log in. I can get the partnerAuthToken with auth.partnerLogin. I decrypt the syncTime and save the offset from the current system time. My request and the response look like this.
{"username":"android","password":"AC7IBG09A3DTSYM4R41UJWL07VLN8JI7","deviceModel":"android-generic","version":"5"}
{"stat":"ok","result":{"stationSkipLimit":6,"partnerId":"42","partnerAuthToken":"VA7Yw5kD1IhUnYogvweA4/FLfFVgRZGX5u","syncTime":"c93c75f71bafb052a18de3b6845cb273","deviceProperties":{"optionalFeatures":{"optionalFeature":[{"feature":"useAudioProxy2","enabled":"false","platformVersionRange":{"low":"4.0","high":"5.0.0"},"productVersionRange":{"low":"1.6","high":"*"}}]},"adRefreshInterval":5,"videoAdUniqueInterval":0,"videoAdRefreshInterval":840,"videoAdStartInterval":180,"ooyala":{"videoAdLoadingTimeout":2,"videoAdBufferRetryCount":3,"streamingPercentage":0,"streamingWhitelist":[534051315],"videoAdPlayTimeout":8}},"stationSkipUnit":"hour"}}
I then send the user authentication request:
{"loginType":"user","username":"abcd","password":"1234","partnerAuthToken":"VA7Yw5kD1IhUnYogvweA4%2FFLfFVgRZGX5u","syncTime":1387125618}
I encode it using blowish in ECB mode and convert to hexcode:
ca86701e8a812dbece89c027ebd95b3217bfee29765b44edf488ddb3d692b9d4c033af64bc62584aa8405eab9c8582d1f374731f7604392d66ed61e73ab5bb4519b3133a6c7f0a4fa6ba8ad6f7140ca157679bce761e628842dc23de75b5840af1b9d2c5a5b265793ccf0c7fda2a7fad7f487c9de42658f57b47696fc586e06215d8cb6d46a7e8208894c052e40a950c
The response I get is:
{"stat":"fail","message":"An unexpected error occurred","code":0}
The my encryption/decryption ciphers are initiated with:
try {
m_encrypt = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
m_encrypt.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(keys.getEncryptKey().getBytes(), "Blowfish"));
m_decrypt = Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
m_decrypt.init(Cipher.DECRYPT_MODE, new SecretKeySpec(keys.getDecryptKey().getBytes(), "Blowfish"));
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
}
According to the unofficial API website, error code 0 is an internal error
I found the problem. My decryption key was correct, but my encryption key was missing a letter.