Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

332
Views
Autenticación OAuth 1.0 para NetSuite

En vano, he intentado que la autenticación OAuth 1.0 funcione para Oracle Netsuite. Cuando genero el encabezado de autenticación con PostMan funciona, pero mi código genera la firma incorrecta, a pesar de que seguí todos los pasos que pude encontrar sobre cómo generar una firma HMAC-SHA1 para OAuth 1.0

Código fuente (Kotlin)

 class NetsuiteAuthenticationScheme { private val algorithm = "HmacSHA1" private val charset = Charsets.UTF_8 fun setAuthenticationHeaders(headers: HttpHeaders, url: String?) { val authentication = mutableMapOf( "realm" to "REALM", "oauth_consumer_key" to "CONSUMER_KEY", "oauth_token" to "TOKEN", "oauth_signature_method" to "HMAC-SHA1", "oauth_version" to "1.0", "oauth_timestamp" to "TIMESTAMP", "oauth_nonce" to "NONCE" ) val signatureUrl = listOf( "POST", URLEncoder.encode(url, charset.displayName()), URLEncoder.encode( URLEncodedUtils.format( authentication .toList() .sortedBy { it.first } .map { BasicNameValuePair(it.first, it.second) }, charset.displayName() ), charset.displayName() ) ).joinToString("&") val signatureKey = listOf( "CONSUMER_SECRET", "TOKEN_SECRET" ).joinToString("&") authentication["oauth_signature"] = computeSignature(signatureUrl, signatureKey) val authenticationHeaderValue = authentication .toList() .joinToString { "${it.first}=\"${URLEncoder.encode(it.second, charset.displayName())}\"" } headers.contentType = MediaType.APPLICATION_JSON headers.add("Authorization", "OAuth $authenticationHeaderValue") } private fun computeSignature(data: String, key: String): String { val mac = Mac.getInstance(algorithm) mac.init(SecretKeySpec(key.toByteArray(charset), algorithm)) return Base64.encodeBytes(mac.doFinal(data.toByteArray(charset))) } }

¿Qué hice mal?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Hay un ejemplo de una conexión oAuth que funciona en Node enNetsuite OAuth no funciona

Esta línea:

 headers.Authorization += ',realm="' + config.accountId + '"';

parece ser lo que te estás perdiendo.

reino no debe ser parte del hash enviado para calcular la firma.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!