Skip to content

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

Description

@wesdimiceli

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.:

cloudinary.url('my_image',{type: 'upload',auth_token: {key: '<encryption-key>',duration: 300},sign_url: true,})

This gives me:
https://res.cloudinary.com/<env>/image/upload/my_image?__cld_token__=exp=1234~hmac=<snip>&_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:

if(sign_url&&isEmpty(auth_token)){

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions