View Full Version : oauth upload
raphinou
Jan-09-2009, 06:14 AM
I've played a bit with oauth and it's working fine (auth, creating albums, listing, etc).
However, for the upload, it is stringly engouraged to use binary methods. Is that possible with oauth, as current documentation shows the usage of a session id.
Thanks
Raphaël
devbobo
Jan-11-2009, 10:39 PM
Hey Raphael,
As per my mailing list reply to you.
If you let me know which upload method you are using, I can give you more details.
Cheers,
David
raphinou
Jan-14-2009, 12:55 AM
Hi David,
Actually, I can use any method.
I'm using the ruby-oauth gem, and it makes it difficult to change the host to which to send the queries like it is required for smugmug (change the host api.smugmug.com to upload.smugmug.com).
I have the access_token, and now I need to look how I can construct the right request....
Update: I think I can correctly send the request, but get an invalid signature response, error code 35:
r=@access_token.put("http://upload.smugmug.com/upload.jpg", File.read("/home/rb/tmp/upload.jpg"), {"X-Smug-ResponseType" => "JSON", "X-Smug-Version" => "1.2.2", "X-Smug-AlbumID" => "album_id".to_s, "X-Smug-Caption" => "uploadforme.com", "Content-MD5" =>Digest::MD5.hexdigest(File.read("/home/rb/tmp/upload.jpg")) })
r.body
=> "{\"stat\":\"fail\",\"code\":35,\"message\":\"invalid signature\"}"
Strange as I can send other requests successfully:
r=@access_token.get("/services/api/json/1.2.2/?method=smugmug.albums.create&Title=UploadForMe")
"{\"stat\":\"ok\",\"method\":\"smugmug.albums.create\",\"Album\": .....}
Is it really the oauth signature or is it the MD5 of the file that's causing problems?
Raphaël
raphinou
Jan-17-2009, 07:48 AM
Hi David,
I'd appreciate your help to help me further. I still get a wrong signature error. What more information can be helpful to get forward?
Thanks
Raphaël
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.