decaporg / decaporg/decap-cms

Cloudinary media library: can't log in using signature and timestamp

Open
#5,437 7 comments 0 reactions 0 assignees View on GitHub
area: extensions/media-libraries type: bug
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

Hello, I'm trying to initialize the CMS manually and pass the Cloudinary signature and timestamp during run time using the Netlify function with the below settings but those parameters are not getting passed. If I pass the complete config with load_config_file:false I'm able to auto sign in to the Cloudinary widget. I referenced these docs https://www.netlifycms.org/docs/beta-features/#manual-initialization and issue https://github.com/netlify/netlify-cms/issues/1999

**Source Code PR:**
https://github.com/hpe-dev-incubator/hpe-dev-portal/pull/275

**To Reproduce**
Follow the instructions from this comment
https://github.com/netlify/netlify-cms/issues/1999#issuecomment-462473073

**Expected behavior**
Should be able to auto-login into Cloudinary media library.

**Screenshots**
![image](https://user-images.githubusercontent.com/12749370/119293584-58cd0400-bc18-11eb-86d4-fa7f1346cd2d.png)

**Applicable Versions:**
- Netlify CMS version: [e.g. 2.0.4]
- "netlify-cms-app": "^2.14.25",
- "netlify-cms-media-library-cloudinary": "^1.3.10",
- OS: macOS Catalina V.10.15.7
- Browser version: Chrome Version 90.0.4430.212
- Node.JS version: v14.16.0

**CMS configuration**
```yaml
backend:
name: github
repo: hpe-dev-incubator/hpe-dev-portal
branch: master
open_authoring: true

publish_mode: editorial_workflow
site_url: https://developer.hpe.com
display_url: https://developer.hpe.com
logo_url: /img/dev-thumb2.png

media_folder: static/img
public_folder: /img
media_library:
name: cloudinary
config:
cloud_name: 'hpe-dev-portal'
api_key: 'xxxxx'
username: 'xxxxxx'
output_filename_only: true

collections:
- label: 'Home'
name: 'home'
format: 'frontmatter'
publish: false
editor:
preview: true
```
**CMS Configuration**
```js
window.CMS_MANUAL_INIT = true;
import CMS, { init } from 'netlify-cms';
import cloudinary from 'netlify-cms-media-library-cloudinary';

const userAction = async () => {
try {
const url = '/.netlify/functions/cloudinary';
const response = await fetch(url);
const resp = await response.json();
init({
config: {
media_library: {
config: {
signature: resp.signature,
timestamp: resp.timestamp,
},
},
},
});

CMS.registerMediaLibrary(cloudinary);
} catch (err) {
console.log('error', err);
}
};

userAction();
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.