Working with OAuth API after Authentication

bmcbridebmcbride USAPosts: 3Registered Users Big grins
I am able to get the access token and secret from the API, however, once I have that, I get an error when trying to use any functions.

If we make the following call:

https://api.smugmug.com/api/v2!authuser?oauth_callback=oob&oauth_consumer_key=MY_KEY&oauth_nonce=7CA2361DC81&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1572348007&oauth_token=TOKEN&oauth_version=2&oauth_signature=SIGNATURE

We get this error:

{"Code":401,"Message":"oauth_problem=signature_invalid&debug_sbs=GET&https%3A%2F%2Fapi.smugmug.com%2Fapi%2Fv2%21authuser&oauth_callback%3Doob%26oauth_consumer_key%3DMY_KEY%26oauth_nonce%3D7CA2361DC81%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1572348007%26oauth_token%3DTOKEN%26oauth_version%3D2"}

We need to write the signature ourselves, but I have tested with Postman with the same results.

We are able to get authenticated, so that makes me believe that our method for creating the signature is correct.

Any help would be appreciated.

Comments

  • bmcbridebmcbride USAPosts: 3Registered Users Big grins
    edited October 29, 2019
    And I have checked, my sbs matches the sbs in the result.
  • devbobodevbobo LR whisperer Melbourne, AUPosts: 4,338Registered Users, Retired Mod SmugMug Employee

    G'day bmcbride,

    I think the issue is that you have included the oauth_callback argument. This argument should only be sent during the authentication process and not on typical api calls.

    Can you please try removing that and see how you go.

    Cheers,

    David

    David Parry
    SmugMug API Developer
    My Photos
  • bmcbridebmcbride USAPosts: 3Registered Users Big grins
    Thanks David, got it working now.
  • AndyAndy Bicameral New YorkPosts: 50,153Registered Users Major grins

    :wink: Thanks Dev!

Sign In or Register to comment.