cloudinary / cloudinary/cloudinary_npm

When strict transformations are enabled, token-based access fails with a 401

Open
#699 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
666
Forks
319
Avg merge
17h 18m
Merged PRs (30d)
3

Description

## Describe the bug in a sentence or two.
When I set both the `auth_token` and `sign_url` parameters on `cloudinary.url`, the resulting URL is given a token but is not signed. Thus, if I have strict transformations enabled, I still get a 401 from the resulting URL.

## Issue Type (Can be multiple)
[ ] Build - Can’t install or import the SDK
[ ] Babel - Babel errors or cross browser issues
[ ] Performance - Performance issues
[x] Behaviour - Functions aren’t working as expected (Such as generate URL)
[ ] Documentation - Inconsistency between the docs and behaviour
[ ] Incorrect Types - For typescript users who are having problems with our d.ts files
[ ] Other (Specify)

## Steps to reproduce
Any basic call to `cloudinary.url`, e.g.:

```ts
cloudinary.url('my_image', {
type: 'upload',
auth_token: { key: '', duration: 300 },
sign_url: true,
})
```

This gives me:
`https://res.cloudinary.com//image/upload/my_image?__cld_token__=exp=1234~hmac=&_a=BAMCkGUm0`

The URL is missing the signature path param, so if I have strict transformations, the URL doesn't work.

Seems like this conditional is preventing it: https://github.com/cloudinary/cloudinary_npm/blob/d12a63fefdd0209ed71c3a641a9d3166126c09d8/lib/utils/index.js#L880

I'm not sure if there's a different reason for it, but as a new user to the platform, my gut feeling says this part might need to change.

## Versions and Libraries (fill in the version numbers)
Cloudinary_NPM SDK version 2.5.1
Node - 18.13.0
~NPM - 0.0.0~
PNPM - 9.4.0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.