Unknown API key from node js
I'm trying to upload files to cloudinary from nodejs, I've verified my account and inputted my key and secret into config. But I get this error each time { message: 'Unknown API key xxxxxxxxxxx;', http_code: 401 }. I've gone as far as generating a new pair but the error still persists.
```
import { v2 } from 'cloudinary';
v2.config({
cloud_name:process.env.CLOUDINARY_CLOUD_NAME,
api_key:process.env.CLOUDINARY_API_KEY,
api_secret:process.env.CLOUDINARY_API_SECRET,
});
v2.uploader.upload(dataUri(file).content);
```
I'm also using postman to test if that helps.
-
With nodeJS, you might want to try:
var cloudinary = require('cloudinary').v2;
cloudinary.config({ cloud_name: 'sample', api_key: '874837483274837', api_secret: 'a676b67565c6767a6767d6767f676fe1' });
cloudinary.uploader.upload("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==", function(error, result) {console.log(result, error); });
Please let me know if that works,
Please sign in to leave a comment.
Comments
2 comments