This support forum is no longer in use. Please use the Cloudinary Community at https://community.cloudinary.com/ to receive assistance from other members of the community and from Cloudinary's support team. For account-specific questions or if you believe that you've encountered a bug, please contact the Cloudinary team directly via the "submit a request" option on this support site.

INVALID SIGNATURE

Comments

4 comments

  • Avatar
    Eric Pasos

    Hi Johnson,

    The upload signature is needed when you are performing a signed REST API call. With the error message you get, you will need to calculate the signature by following the procedure as described in the documentation.

    For your case, you could generate the signature as:

    API Secret: 'yourapisecret'
    Parameter to sign: 'folder=Kernel&timestamp=1669284769'

    Creating the SHA-1 signature:
      SHA1('folder=Kernel&timestamp=1669284769yourapisecret')

    For more information, kindly see: https://support.cloudinary.com/hc/en-us/articles/207885595-How-can-I-generate-the-signed-upload-payload-on-my-server-

    0
    Comment actions Permalink
  • Avatar
    johnson owusu prah

    please is there a code error or something ,i have followed and repeated  the recommendations of the doCs yet same error 

     

    ----------THIS IS NOW MY NEW CODE,SHOULD I INCLUDE OR DELETE SOME LINES-----------

    const cloudinary = require('cloudinary').v2 ;
    const {CloudinaryStorage} = require('multer-storage-cloudinary')
    const crypto = require('crypto')

    cloudinary.config({
        cloud_name :  process.env.CLOUDINARY_SECRET,
        api_key :   process.env.CLOUDINARY_KEY,
        api_secret :  process.env.CLOUDINARY_NAME
       
    })

    const storage =new CloudinaryStorage({
        cloudinary,
        params : {
            folder : 'Kernels',
            allowedFormats : ['jpeg','png','jpg']
        }
    })


    // const singnature = SHA1('folder=Kernel&timestamp=1669284769')

    const apiSecret = cloudinary.config().api_secret;
    const SHA1= function(input){
      return crypto.createHash('sha1').update(JSON.stringify(input)).digest('hex')
    }

    const signuploadform = () => {

        const timestamp = Math.round((new Date).getTime()/1000);

        const signature = cloudinary.utils.api_sign_request(SHA1('folder=Kernel&timestamp=timestamp+apiSecret'),
           apiSecret);
     
        return { timestamp, signature }
      }

    module.exports = {
        cloudinary,
        storage,
        signuploadform
    }

     
    0
    Comment actions Permalink
  • Avatar
    Tia Esguerra

    Hi there,

    I would take a look at your cloudinary.config() You seem to have a couple of values out of place, according to what you have shared here. I see that you specified `cloud_name :  process.env.CLOUDINARY_SECRET` and `api_secret :  process.env.CLOUDINARY_NAME`. Instead, please try `api_secret :  process.env.CLOUDINARY_SECRET`  and `cloud_name :  process.env.CLOUDINARY_NAME`

    Let me know how it goes after making those changes. I look forward to your reply. 

    Kind Regards, 

    Tia

    0
    Comment actions Permalink
  • Avatar
    johnson owusu prah

    oh yeas...Thanks so much...Error resolved

    0
    Comment actions Permalink

Post is closed for comments.