Media Library not using provided cloud_name
Hi there,
we are currently encountering a behaviour when using the Media-Library that is kind of breaking functionality for us.
Background:
We manage a Cloudinary account with multiple sub-accounts for our customers.
In our application we use the Media-Library and open the Widget like this:
this.cloudinaryWidget = window.cloudinary.openMediaLibrary(
{
cloud_name: storage.cloudinaryCloudName,
api_key: storage.cloudinaryApiKey,
timestamp: storage.cloudinaryTimestamp,
signature: storage.cloudinaryLoginSignature,
username: storage.cloudinaryUserName,
multiple: false,
},
{
insertHandler: data => { ... },
}
)
Now, to describe the behaviour:
1. I log in to our Cloudinary-Account through the Website and go into subaccount/cloudname "a"
2. I log into our application for customer "b".
3. The application fetches the correct configuration (verified this multiple times when debugging) and calls the openMediaLibrary function with the cloudname "b".
4. The widget opens correctly but shows the contents of cloudname "a".
It seems like the Media-Library ignores the cloudname that was provided through the JavaScript and instead uses the cloudname of my last session in Cloudinary (Website).
Can you support us on this? It's kind of breaking our UX.
-
Hi Joscha,
The Media Library Widget and the main Media Library on www.cloudinary.com share a session, which means we don't support having multiple tabs open with different sessions, so the basics of what you've described make sense. You'd see the same problem if you have multiple browser tabs open on the Media Library, switch account via the selector in one tab, then do something in the other without refreshing.
That said, I wasn't able to reproduce the exact case described here - I tested this myself and when I open sub-account / cloud name A in the Media Library, and then initialize the Media Library widget with cloud_name B, the Media Library Widget opens B as I expect.
Order of operations:
Log in to account in web UI and select sub-account A
cloudinary.createMediaLibrary() with cloud_name: B and the api key for sub-account B
click the button that triggers the library to open
cloud_name: B is shown in the WidgetIn your example, is the first time that the cloud name is provided to the Media Library Widget via the call to openMediaLibrary(), or was it initialized earlier with createMediaLibrary(), and then the user changed sub-account via a different tab using the main Media Library UI?
If you open the widget with one account, then switch to another via the web interface in the same browser, the behaviour is undefined, but I'd expect whichever was refreshed or initialised last (web UI, widget) will 'win'.If you need to use the UI and widget simultaneously, I recommend using different browsers, different browser profiles, or a browser or browser extension that uses different sessions in different tabs
Regards,
Stephen0
Post is closed for comments.
Comments
1 comment