We're migrating to oauth2 per the FB road map. This set of commits along with the commits for mogli start down that path. The changes are incremental, and reflect what we need, basically the ability to use the oauth2 cookie to get an access token.
Please let me know if you have questions or want changes.
Cookie name controlled by yml
Fixing the cookie prefix assembly, initial shot at additional tests f…
…or Facebooker2 module
Base64 url encoding produces strings divisible by four, not by six
Using the existing sig verification code
Working Base64 URL decoding along with appropriate tests
This looks good, but I'm a little worried about a couple of things. First, I don't like the conditional and the configuration bits. Can we not try oauth2 and fall back to oauth if the oauth2 stuff isn't there? Also, it looks like code coverage is really light. Are all of the methods well covered?
I used the configuration approach to reduce the impact on folks that aren't ready to migrate yet. Falling back to oauth1 from oauth2 at runtime will lead to more complicated code imo. The FB JS SDK requires the specific property 'oauth : true' and this setting changes the cookie name and cookie contents. The configuration makes it clear you're using oauth, and drives control down only that path. Also, you can simply enable or disable oauth2 by changing one configuration variable. That makes life simple for the gem users.
I'm trying to minimize the scope of change. This code doesn't represent a fully oauth2 compliant library since we currently don't need that (yet). I'm presuming folks that need more oauth2 functionality will build on what your code and my changes. If we had a full implementation it might be possible to more easily fall back.
Thanks for the detail. That all makes sense to me. Requiring java for tests is a non-starter for me, so the current stuff is fine. I can cherry pick in this commit. Thanks!
You see the Mogli pull request as well right? That's necessary for this to run properly. That change is minimal and includes testing.