Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SmugMug Module #287

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

SmugMug Module #287

wants to merge 8 commits into from

Conversation

HynesIP
Copy link

@HynesIP HynesIP commented Jul 17, 2015

Proposed module previously tested in HynesIP fork that is 462 commits behind.

Proposed module previously tested in HynesIP fork that is 462 commits behind.
@HynesIP
Copy link
Author

HynesIP commented Jul 17, 2015

It seems like there may be very little to do to allow this to succeed.

@HynesIP
Copy link
Author

HynesIP commented Jul 17, 2015

SmugMug support referenced http://tools.ietf.org/html/rfc5849#section-2.3 and http://tools.ietf.org/html/rfc5849#section-3.1 when I asked about how to proceed.

version : "1.0a",
auth : "http://api.smugmug.com/services/oauth/1.0a/authorize?Access=Full&Permissions=Modify",
//http://api.smugmug.com/services/oauth/1.0a/authorize?Access=Full&Permissions=Modify&allowThirdPartyLogin=0&showSignUpButton=false&viewportScale=1.0
request : "http://api.smugmug.com/services/oauth/1.0a/getRequestToken?oauth_callback=http://localhost:3000/redirect.html",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please omit the oauth_callback. The value of oauth_callback is derived from the redirect_uri at the point the OAuth1a request URI is constructed by the OAuth Proxy service.

Removed oauth_callback parameter
Local testing produces same results. Popup stays open on URL http://localhost:3000/redirect.html?Access=Full&Permissions=Modify&oauth_token=4f0964e2beeaacca3948ba3a8f7d91a0&oauth_verifier=100103
@HynesIP
Copy link
Author

HynesIP commented Jul 18, 2015

  • I removed the redirect in the plugin : same result.
  • I upgraded my hello.all.js to the latest : same result.
  • I changed the API credentials to remove the redirect from the SmugMug settings : the shim started to return the same structure as Twitter and Flickr. But, that URL from your shim was resulting in "Uncaught SyntaxError: Unexpected end of input". When I ran it through an old clone of your shim that I've been running for about a year, I get a Uri Malformed error.

I'll send the URLs from each shim and indicate the line in hello.js that is reporting the Uri Malformed.

@HynesIP
Copy link
Author

HynesIP commented Jul 18, 2015

Url when using: https://auth-server.herokuapp.com/proxy:
http://localhost:3000/redirect.html?proxy_url=http%3A%2F%2Fauth-server.herokuapp.com%2F&state=%7B%22client_id%22%3A%22hVc1tgPSx8uSENAlC5JYkgfxmwcShiG8%22%2C%22network%22%3A%22smugmug%22%2C%22display%22%3A%22popup%22%2C%22callback%22%3A%22_hellojs_b4gkfy3y&oauth_token=79333d1f24ce08e5dde6f1c0ec7125bc&oauth_verifier=465642
Console output:
"Uncaught SyntaxError: Unexpected end of input"

Url when using: https://hip-oauth.herokuapp.com/proxy:
http://localhost:3000/redirect.html?proxy_url=http%3A%2F%2Fhip-oauth.herokuapp.com%2F&state=%7B%22client_id%22%3A%22hVc1tgPSx8uSENAlC5JYkgfxmwcShiG8%22%2C%22network%22%3A%22smugmug%22%2C%22display%22%3A%22popup%22%2C%22callback%22%3A%22_hellojs_95eizlmw%2&oauth_token=2775a0d0ffb0b6414064649beb9f006d&oauth_callback=http%3A%2F%2Flocalhost%3A3000%2Fredirect.html%3Fproxy_url%3Dhttp%253A%252F%252Fhip-oauth.herokuapp.com%252F%26state%3D%257B%2522client_id%2522%253A%2522hVc1tgPSx8uSENAlC5JYkgfxmwcShiG8%2522%252C%2522network%2522%253A%2522smugmug%2522%252C%2522display%2522%253A%2522popup%2522%252C%2522callback%2522%253A%2522_hellojs_95eizlmw%2522%252C%2522state%2522%253A%2522%2522%252C%2522redirect_uri%2522%253A%2522http%253A%252F%252Flocalhost%253A3000%252Fredirect.html%2522%252C%2522scope%2522%253A%2522basic%2522%252C%2522oauth%2522%253A%257B%2522version%2522%253A%25221.0a%2522%252C%2522auth%2522%253A%2522http%253A%252F%252Fapi.smugmug.com%252Fservices%252Foauth%252F1.0a%252Fauthorize%2522%252C%2522request%2522%253A%2522http%253A%252F%252Fapi.smugmug.com%252Fservices%252Foauth%252F1.0a%252FgetRequestToken%2522%252C%2522token%2522%253A%2522http%253A%252F%252Fapi.smugmug.com%252Fservices%252Foauth%252F1.0a%252FgetAccessToken%2522%257D%252C%2522oauth_proxy%2522%253A%2522https%253A%252F%252Fhip-oauth.herokuapp.com%252Fproxy%2522%257D%26token_url%3Dhttp%253A%252F%252Fapi.smugmug.com%252Fservices%252Foauth%252F1.0a%252FgetAccessToken%26client_id%3DhVc1tgPSx8uSENAlC5JYkgfxmwcShiG8&oauth_verifier=371094

Uncaught URIError: URI malformed

from, Line 737 of hello.all.js:
if (m) {
for (var i = 0; i < m.length; i++) {
b = m[i].match(/([^=]+)=(.*)/);
a[b[1]] = formatFunction(b[2]);
}
}

@HynesIP
Copy link
Author

HynesIP commented Jul 19, 2015

Here's where it breaks on both:
&state=%7B%22client_id%22%3A%22REMOVED%22%2C%22network%22%3A%22smugmug%22%2C%22display%22%3A%22popup%22%2C%22callback%22%3A%22_hellojs_95eizlmw%2

@HynesIP
Copy link
Author

HynesIP commented Jul 19, 2015

I changed to API credentials that included a callback in the SmugMug settings and got a different response URL on my old shim (same result as above on https://auth-server.herokuapp.com/proxy):

http://localhost:3000/redirect.html?oauth_token=aaeb55210f4a464abc50519f49fb7388&oauth_callback=http%3A%2F%2Flocalhost%3A3000%2Fredirect.html%3Fproxy_url%3Dhttp%253A%252F%252Fhip-oauth.herokuapp.com%252F%26state%3D%257B%2522client_id%2522%253A%2522NFfNfAK47ZfnkMl4EjO48pgEQQWCMFJu%2522%252C%2522network%2522%253A%2522smugmug%2522%252C%2522display%2522%253A%2522popup%2522%252C%2522callback%2522%253A%2522_hellojs_7eknb015%2522%252C%2522state%2522%253A%2522%2522%252C%2522redirect_uri%2522%253A%2522http%253A%252F%252Flocalhost%253A3000%252Fredirect.html%2522%252C%2522scope%2522%253A%2522basic%2522%252C%2522oauth%2522%253A%257B%2522version%2522%253A%25221.0a%2522%252C%2522auth%2522%253A%2522http%253A%252F%252Fapi.smugmug.com%252Fservices%252Foauth%252F1.0a%252Fauthorize%2522%252C%2522request%2522%253A%2522http%253A%252F%252Fapi.smugmug.com%252Fservices%252Foauth%252F1.0a%252FgetRequestToken%2522%252C%2522token%2522%253A%2522http%253A%252F%252Fapi.smugmug.com%252Fservices%252Foauth%252F1.0a%252FgetAccessToken%2522%257D%252C%2522oauth_proxy%2522%253A%2522https%253A%252F%252Fhip-oauth.herokuapp.com%252Fproxy%2522%257D%26token_url%3Dhttp%253A%252F%252Fapi.smugmug.com%252Fservices%252Foauth%252F1.0a%252FgetAccessToken%26client_id%3DNFfNfAK47ZfnkMl4EjO48pgEQQWCMFJu&oauth_verifier=008576

@HynesIP
Copy link
Author

HynesIP commented Jul 19, 2015

I see the proper response Url in those parameters, but don't know where or how it's parsed out.

@HynesIP
Copy link
Author

HynesIP commented Jul 20, 2015

Could it be choking on the Access and Permissions parameters? I removed them from the Url, but don't know how to list them in the module.

The values can:

Parameter Values Default Description
Access Full or Public Public To change what data your app can see
Permissions Read, Add, or Modify Read To change what your app can do with the data

@HynesIP
Copy link
Author

HynesIP commented Jul 20, 2015

This is the SmugMug reference: https://api.smugmug.com/api/v2/doc/tutorial/authorization.html

@HynesIP
Copy link
Author

HynesIP commented Jul 22, 2015

I found your Module wiki and looked at the other 1.0a examples. I'll make changes to the PR module to match that API.

HynesIP added 2 commits July 22, 2015 07:32
Bare minimum to get Access Token. This doesn't change the results, however.
This was referenced Jul 22, 2015
HynesIP added 2 commits July 22, 2015 13:56
Add CLIENT_ID and add variable to CLIENT_IDS_ALL obj
@HynesIP
Copy link
Author

HynesIP commented Jul 24, 2015

I seeded a new local copy of the shim to see the values and responses. SmugMug never gets to Step 2. Unless something seems obvious to you, please don't spend too much time on this PR. Their version 2 is still Beta and I suspect the poor response may be on their end.

@aldrinleal
Copy link

Can you try using decodeURIComponent instead of decodeURI?

@aldrinleal
Copy link

e.g.:

decodeURI("%7B%22client_id%22%3A%224sbt5ama5llhhp0h91o59qeunb%22%2C%22network%22%3A%22meetup%22%2C%22display%22%3A%22page%22%2C%22callback%22%3A%22_hellojs_bktbqsvc%22%2C%2")
URIError: URI malformed
    at decodeURI (native)
    at repl:1:1
    at REPLServer.defaultEval (repl.js:262:27)
    at bound (domain.js:287:14)
    at REPLServer.runBound [as eval] (domain.js:300:12)
    at REPLServer.<anonymous> (repl.js:427:12)
    at emitOne (events.js:82:20)
    at REPLServer.emit (events.js:169:7)
    at REPLServer.Interface._onLine (readline.js:211:10)
    at REPLServer.Interface._line (readline.js:550:8)
> unescape("%7B%22client_id%22%3A%224sbt5ama5llhhp0h91o59qeunb%22%2C%22network%22%3A%22meetup%22%2C%22display%22%3A%22page%22%2C%22callback%22%3A%22_hellojs_bktbqsvc%22%2C%2")
'{"client_id":"4sbt5ama5llhhp0h91o59qeunb","network":"meetup","display":"page","callback":"_hellojs_bktbqsvc",%2'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants