cloudinary / cloudinary-react

React components that utilize Cloudinary functionality
MIT License
500 stars 219 forks source link

Support for token based authentication? #242

Open bristoljon opened 2 years ago

bristoljon commented 2 years ago

Hi, trying to work out how best to integrate token based authentication with this SDK.

Our backend provides a token giving access to specific folders in Cloudinary which we can append to the delivery url for assets to allow client to access restricted images however not sure how to provide this to the Cloudinary context...

Was hoping it would be something like:

<CloudinaryContext cloudName="demo" token={token}>
  <Image publicId="sample">
    <Transformation width="200" crop="scale" angle="10"/>
  </Image>
</CloudinaryContext>

And the SDK appends the token passed as a param.

d-mendoza commented 2 years ago

@bristoljon I have not found a good way to add this and it's definitely a missing feature to be able to add query strings. I will raise this with our team.

bristoljon commented 2 years ago

Thanks @d-mendoza, we have actually switched to the new React SDK version and so are using @cloudinary/url-gen to configure the url generator now so we would not need it added to this package if it's made available there.

d-mendoza commented 2 years ago

We would most likely add it to V2, but once I have more details, I'll send an additional update.