OAuth upload issues
taaz
Registered Users Posts: 1 Beginner grinner
Hi, I've been slowly writing my own OAuth based uploader tool and am having a few difficulties. The code works fine if calling something like smugmug.albums.get, but for uploads it's wacky. I've got some code I was running a month ago, and it would randomly either successfully upload an image or fail for some reason I forget. The other day it worked a few times in a row then started failing. Now it fails always. This random output for the same input is odd enough, but even the failures are random. It now fails in one of two ways: ~80% of the time with code 1, and ~20% of the time with code 35.
I get back one of the following "200 OK" JSON failure responses:
{
"stat": "fail",
"code": 1,
"message": "We're sorry, but you don't appear to be logged in to that account. Please login and try again."
}
{
"stat": "fail",
"code": 35,
"message": "invalid signature"
}
The same OAuth credentials work for other calls, so I assume they are ok. I have no idea what that code 1 message even means in the context of OAuth. Getting a new token doesn't fix it. The code 35 response is also odd since it's the exact same request as the first call as far as I can tell. It might very well be some edge case in the Python OAuth lib I'm using but I kind of doubt it.
Any hints on what to look for to fix this?
I assume using "200 OK" for the failure responses is a bug?
Also, please document the upload failure codes:
http://wiki.smugmug.net/display/API/Uploading
Thanks for any help.
-dave
I get back one of the following "200 OK" JSON failure responses:
{
"stat": "fail",
"code": 1,
"message": "We're sorry, but you don't appear to be logged in to that account. Please login and try again."
}
{
"stat": "fail",
"code": 35,
"message": "invalid signature"
}
The same OAuth credentials work for other calls, so I assume they are ok. I have no idea what that code 1 message even means in the context of OAuth. Getting a new token doesn't fix it. The code 35 response is also odd since it's the exact same request as the first call as far as I can tell. It might very well be some edge case in the Python OAuth lib I'm using but I kind of doubt it.
Any hints on what to look for to fix this?
I assume using "200 OK" for the failure responses is a bug?
Also, please document the upload failure codes:
http://wiki.smugmug.net/display/API/Uploading
Thanks for any help.
-dave
0
Comments
Can you please provide some sample requests that are failing ?
Our LR plugin uses OAuth excusively and we have no problems with uploading with respect to signature generation or sessions.
Cheers,
David
SmugMug API Developer
My Photos
I'm having similar issues: my oauth code works fine for regular API calls, but fails for uploading with the code 1 quoted above. Here is a sample request for a PUT request:
http://upload.smugmug.com/DSC03530.jpg?oauth_body_hash=SZW2JwLldr1naiRmpR6VRJZueI8%3D&oauth_nonce=75241090&oauth_timestamp=1318146482&oauth_consumer_key=TohMYRmtDk0kw6aLmHyMS732dElJU7Wm&oauth_signature_method=HMAC-SHA1&oauth_version=1.0a&oauth_token=d79ae054d6e543c13ce632faf2b8cf52&oauth_signature=l4KxWjtaLqjS2VmwHHputDMp208%3D&X-Smug-FileName=DSC00022.jpg&X-Smug-Version=1.3.0&X-Smug-AlbumID=13846866&X-Smug-AlbumKey=V6hJqN
Any help is appreciated!
Thanks,
Christoph
A couple of things...
- X-Smug-* are meant to be http headers, not included as GET/POST vars and hence shouldn't be included in the base string during oauth_signature generation.
- we don't support oauth_body_hash
Hope this helps,
David
SmugMug API Developer
My Photos