• Gear
  • Shots
  • Photo Craft
  • Video
  • Wide Angle
  • Support
  • New Stuff
  • More
Support SmugMug APIs, Hacks & Tricks oAuth & API help for Newbie

FAQtoid

Ever wanted to create an Avatar? Creating an Avatar!

Searching Dgrin with Google Searching with Google

Dgrin Challenges

Congratulations to the Winner of DSS #128 (Sunrise or Sunset), ShootingStar.

The next Dgrin Challenge DSS #129 (Silhouette Revisited ) is open for entries through May 27th, 2013 at 8:00pm PDT.

As always, we look forward to your participation but please do take a moment to read through the rules before posting your entry.

Past DSS Challenge Winners, DSS Challenge Rules, and other important DSS Challenge information is here.

Need some help with Accessories?

Tutorials

Ever find yourself wondering just how someone managed to create an image using different effects?

Here are three simple tutorials we hope will encourage you to try something new.

The Hot Seat

A lifelong interest in landscape photography has led Eyal Oren to make a study of his adopted hometown of Marblehead, MA. As you can see, his dedication is paying off!

Africa!

Dgrinners Harryb, Pathfinder, and others joined Andy Williams and Marc Muench on Safari in East Africa recently. Here are some awesome threads to check out!

 
Thread Tools Display Modes
Old Oct-09-2012, 10:21 AM
#1
lmissak is offline lmissak OP
Beginner grinner
oAuth & API help for Newbie
Hi, I just joined the forum and was looking into how to use oAuth and the API. I have been playing around with the javascript oAuth library found here http://oauth.googlecode.com/svn/code/javascript/. I've never used oAuth before and am confused on a few things. The example page from the above link has a "Get Request Token" form which generates an oauth_timestamp, oauth_nonce, oauth_signature, oauth_token and oath_token_secret using HMAC-SHA1. It then has an "Authorize" form which takes the request token value and sends it to http://api.smugmug.com/services/oauth/authorize.mg to bring up the SmugMug Authorize page where i click on the Authorize button and my App gets authorized. That's all good. What I don't understand is what do I do next????

So my app is authorized. Now, lets say, I want to create a new album. Using http://api.smugmug.com/services/api/json/1.3.0/ and method=smugmug.albums.create, where do I get the required oauth arguments from? Do i have to generate them each time I make one of these API calls or do i use the same values that I used to authorize the app in the first place? Sorry if this sounds totally basic but I've never done something like this before an I'm totally lost and haven't found any good examples of how to do it. :(

Any help would be much appreciated.

Thanks!
Old Oct-11-2012, 04:45 AM
#2
Pharfignewton is offline Pharfignewton
Beginner grinner
1. use your OAuthSecret and APIKey and request a temporary ( < 30 min ? ) token Id/Secret with smugmug.auth.getRequestToken

2. generate an authorization url using your APIkey, temporary Token Id/Secret, Access level, and Permission Level

3. ask user authorize your app via the above url

4. use your OAuthSecret, APIKey, temp Token Id and Secret, call smugmug.auth.getAccessToken for a persistent Token ID and Token Secret

5. use your OAuthSecret, APIKey, and persistent Token ID and Secret for all subsequent requests


You'll need to juggle a persistent token ID & Secret pair per smugmug user

The persistent token ID & Secret are valid until your application forgets them, your OAuthSecret/APIKey changes, or the user changes/sacks your app in their control panel.

The perm and temp Token Id/Secret are supposedly keyed to only work with your OAuthSecret and APIKey
Old Oct-11-2012, 06:45 AM
#3
lmissak is offline lmissak OP
Beginner grinner
Thank you for replying! You make it sound so easy. I just have a few things that are still unclear. Where does the oauth_signature value come in and from where?

Also, once I have the persistent Token ID and Token Secret, do I still need to generate and send a unique oauth_nonce and oauth_timestamp each time I make an API call?

Thanks!
Old Oct-11-2012, 08:59 AM
#4
Pharfignewton is offline Pharfignewton
Beginner grinner
hic sunt dracones
Quote:
Originally Posted by lmissak View Post
Thank you for replying! You make it sound so easy. I just have a few things that are still unclear. Where does the oauth_signature value come in and from where?

Also, once I have the persistent Token ID and Token Secret, do I still need to generate and send a unique oauth_nonce and oauth_timestamp each time I make an API call?

Thanks!
The signature is based on the timestamp and a nonce - both should change every request.

The lib really should be managing these details for you. the read me for that lib has a nice warning: 'This library isn't as useful as you think it's going to be.'

Try building a small test app using a mature library ( phpSmug isn't sexy, but works for me ) - once you have a reference, then maybe work on the javascript library so it manages the minutia before deploying an app using it
Old Oct-11-2012, 09:36 AM
#5
lmissak is offline lmissak OP
Beginner grinner
Ha ha, yes i saw the warning. I did download phpSmug and am starting to play around with it. Thank you for all the info you've given me. It really cleared up some blind spots I had.

Thanks again!
Tell The World!  
Similar Threads Thread Starter Forum Replies Last Post
how to upload image using REST api, (oauth and C#) sujit1779 SmugMug APIs, Hacks & Tricks 0 Dec-23-2011 11:01 AM
Smugmug API with oAuth + .NET dlado SmugMug APIs, Hacks & Tricks 2 Mar-23-2010 04:35 AM
checkAccessToken API (for OAuth) Thinker SmugMug APIs, Hacks & Tricks 1 Aug-17-2009 07:18 PM
Api using Oauth and image URL's matthewpjw SmugMug APIs, Hacks & Tricks 8 Mar-23-2009 12:50 AM
API Update Archive devbobo SmugMug APIs, Hacks & Tricks 0 Oct-09-2007 04:16 PM


Thread Tools
Display Modes

Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump