Skip to content

Instantly share code, notes, and snippets.

@nhobi
Last active May 20, 2019 16:14
Show Gist options
  • Save nhobi/0b8d0f73379831bd3f3282d5648894c1 to your computer and use it in GitHub Desktop.
Save nhobi/0b8d0f73379831bd3f3282d5648894c1 to your computer and use it in GitHub Desktop.
Network Request
# Note: Both these requests are being fired by the cloudinary medialibrary js code, not my code.
# Works! This is 'copy as curl' from Chrome, where I don't get the 401 error.
curl 'https://cloudinary.com/console/api/v1/auth/login_from_session' \
-H 'pragma: no-cache'
-H 'cookie: _ga=GA1.2.813819547.1538000561; __utma=136482402.813819547.1538000561.1557868798.1557868798.1; __utmz=136482402.1557868798.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _mkto_trk=id:396-LRB-524&token:_mch-cloudinary.com-1557868798202-41547; intercom-session-f8c4avgs=eU9ZUWlHa3M4SGRKdmMrTjZKU2cvM2FwNkc2blRiaFVoNnFqOHp6OGxVWFBtREo3cFZxOWdCNnNQVnM3cjR2Ry0td2FtY083YVlQY1F1dXQvNXAzRERNQT09--23ea95a8522a7e2e61e0f2a9d427399076fffd0b; new_ml_enabled=yes; _cld_session_key=9a4aad31e7fdfb49e8c2d84aa0058260; _gid=GA1.2.1358471984.1558366586; _gat_UA-25966579-7=1; AWSALB=KOnDJDzN5FvI0QMXbBowU1lYTxi1xdSr8cQEJIDYz2uVPho7FamV++d8iSWr6moSaze+QFXg9Q3s+zK6VB+gL7CIXsU9TGaPImTHfZh9NWD06pHOG4dWJX9hhTl4'
-H 'accept-encoding: gzip, deflate, br' \
-H 'x-console-version: 501' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36' \
-H 'content-type: application/json' \
-H 'accept-language: en-US,en;q=0.9,la;q=0.8,lb;q=0.7' \
-H 'accept: application/json' \
-H 'cache-control: no-cache' \
-H 'authority: cloudinary.com' \
-H 'referer: https://cloudinary.com/console/media_library/cms?pmHost=https://boma.test&new_cms=true&ml_id=ml_0&cloud_name=nhc&api_key=191128912137679&username=nate%40natehobi.com&timestamp=1558366608&signature=b80f2adc55e3a24e33e8cbd85d175c16f0e478e6614d5364075b95c737f1d5ef'
--compressed
# Doesn't work! This is 'copy as curl' from safari, where I do get the 401. Notice several missing headers.
curl 'https://cloudinary.com/console/api/v1/auth/login_from_session' \
-XGET \
-H 'Accept: application/json' \
-H 'Accept-Language: en-US,en;q=0.9,la;q=0.8,lb;q=0.7' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-H 'Pragma: no-cache' \
-H 'Origin: https://boma.test' \
-H 'Referer: https://boma.test/admin/galleries/1/edit' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15' \
-H 'x-console-version: 501'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment