Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

240
Visualizações
Can't upload image to Cloudinary using client side signature call - invalid signature

I can't seem to generate the correct signature to upload an image successfully.

Error message -

message:'Invalid Signature 953e29c9b5cac0f611e347d508aaff75f11f0547. String to sign - 'timestamp=1631318071'.'

Maybe someone can tell me what I'm going wrong? Maybe the order of something (according to the docs)?

FYI - I tried changing the order I pass in the parameters server side but it didn't seem to do much to successfully upload.

Here is how I generate the signature client side (C#) and pass data to the client (Angular)

DateTime foo = DateTime.Now;
long timeStamp = ((DateTimeOffset)foo).ToUnixTimeSeconds();
var p = new Dictionary<string, object>();
p.Add("api_key", _cloudinaryConfig.Value.ApiKey);
p.Add("api_secret", _cloudinaryConfig.Value.ApiSecret);
p.Add("cloud_name", _cloudinaryConfig.Value.CloudName);
p.Add("timestamp", timeStamp);
var signature = _cloudinary.Api.SignParameters(p);
return Ok(new {
   cloudUploadUrl = _cloudUploadUrl, 
   cloudName = _cloudinaryConfig.Value.CloudName, 
   cloudApiKey = _cloudinaryConfig.Value.ApiKey, 
   cloudSignature = signature,
   cloudTimeStamp = timeStamp
});

Here is the client trying to upload an image in Angular

const data = new FormData();
data.append('file', croppedImage.base64);
data.append("api_key", cloudinaryParams.cloudApiKey);
data.append("signature", cloudinaryParams.cloudSignature);
data.append("timestamp", cloudinaryParams.cloudTimeStamp);

const fileResult = await fetch(cloudinaryParams.cloudUploadUrl, {
  method: 'POST',
  body: data,
});

const fileData = await fileResult.json();

if (fileData.error) {
  // do something to handle the error!
}

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The string in the error message shows the parameters that are being checked on the server side against the signature you provided on the upload API call.

Based on that error, the only parameter that should be used to create the signature for your example upload API call is "timestamp", and it needs to have a value of 1631318071 on both the API call and in the function that created the signature: https://cloudinary.com/documentation/signatures

If I understand your C# code correctly, you can most likely fix this by removing all the p.add() calls except the one with the timestamp parameter

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda