This topic contains 5 replies, has 4 voices, and was last updated by joedenly 5 years, 1 month ago.
- Topic
Hi there,
I try to figure out how do I get a connection to the API for OroPlatform 3.1 for a Kotlin App.
Here is what I’ve done:123456789101112131415161718public fun getHeader() {val prefs = PreferenceManager.getDefaultSharedPreferences(this.context)val user = prefs.getString("oro_user", "<unset>")val key = prefs.getString("oro_api_key", "<unset>")val md = MessageDigest.getInstance("SHA-1")//val nonce = base64_encode(substr(md5(uniqid()), 0, 16));val nonce = Base64.encode(md.digest(UUID.randomUUID().toString().toByteArray()), 0, 16,0)val sdf = SimpleDateFormat("yyyy-MM-dd hh:mm:ss+1:00", Locale.GERMAN)val created = sdf.format(Date())// digest 28 chars// nonce 24 charsval digest = Base64.encode((md.digest(nonce).toString()+created+key).toByteArray(), 0, 28, 1)var wsseHeader = "Authorization: WSSE profile=\"UsernameToken\"\n";wsseHeader += "X-WSSE: UsernameToken Username=\"$user\", PasswordDigest=\"$digest\", Nonce=\"$nonce\", Created=\"$created\""Log.i("data", wsseHeader)}The problem is,that the strings for nonce and digest are just 10 chars long not as mentioned in the cookbook 28 and 24.
Does anyone faces the same problem and found a solution ?
The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.