[TIMOB-25727] iOS: base64decode issue observed with SDK 7.0.0 and above
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-02-07T17:24:04.000+0000 |
Affected Version/s | Release 7.0.0 |
Fix Version/s | Release 7.0.2 |
Components | iOS |
Labels | n/a |
Reporter | Aminul Islam |
Assignee | Hans Knöchel |
Created | 2018-01-26T15:12:28.000+0000 |
Updated | 2018-11-15T12:35:36.000+0000 |
Description
Hi,
We have an oAuth login module to login to our app. During the login process, we will have to decode a token. For this we have used Titanium.Utils.base64decode(token).
The same code works for TiSDK 6.3.0 and below.
Once we upgraded the sdk to 7.0.0 the same returns undefined
Below is the toke thats received while logging in using oAuth.
token
"eyJzdWIiOiJ0ZXN0IiwiZW1haWwiOiJ0ZXN0IiwiYXVkIjoidGVzdCIsImp0aSI6ImxvTHM4d2o5aWxBQUtWckNxbzhaMFMiLCJpc3MiOiJodHRwczpcL1wvc3NvLmV4YW1wbGUuY29tIiwiaWF0IjoxNTI2MTY3NDc3LCJleHAiOjE1MjYxNjc0NzcsInBpLnRlc3QiOiJMSTRmMW81Q2pqU2tHU2xTanM0bHlPeVlROCJ9"
We have checked this in a simple code with only the below line
Titanium.Utils.base64decode(token)
Works fine in 6.3.0 and returns undefined in 7.0.0 and above
Thanks
*EDIT by Hans*: This ticket also fixes an issues where Android would not accept Ti.Filesystem.File parameters in base64decode
.
Attachments
File | Date | Size |
---|---|---|
decodedFile.txt | 2018-01-28T21:27:17.000+0000 | 21 |
PR (master): https://github.com/appcelerator/titanium_mobile/pull/9773 PR (7_0_X): https://github.com/appcelerator/titanium_mobile/pull/9779 To be tested on both iOS and Android and together with the attached decodedFile.txt:
FR Passed. Base64 encoding and decoding is working as expected. Tested using the provided sample as well as the Utilities suite.
Verified changes included in SDK builds 7.0.2.v20180207091331 & 7.1.0.v20180205203710
Still happening in TiSDK 7.4.1 and iOS 12. I have an encrypted file transformed in a blob that it's sent to the server. In order to do so we encode it in base 64. Basically once it's encoded, can't be decoded. Following the encoded string:
When we decode it with any online decoder, i's decoded as expected. When we decode it with Titanium, we get the result to be null. This broke our application and we would need an urgent fix!
we ended up using an external library (https://github.com/ekscrypto/Base64) that actually works. The simple conversion you do with:
doesn't work with our encrypted nsdata.