Ruby OAuth 401 Unauthorized due to SSL issues with load balancer Ruby OAuth 401 Unauthorized due to SSL issues with load balancer

June 3, 2012   |   Tech
Agile League

I spent the whole day today tearing my hair out over why I could not get my OAuth 1.0 provider to work on the staging server, but it worked fine in development. I couldn’t even request a token. Instead, every OAuth request was rebuffed with a 401.
What I finally discovered was that there was some sort of issue with our new Amazon Elastic Load Balancer (ELB) and its SSL settings. I’m not sure what exactly the issue is, but I’m guessing that the ELB server looked very similar to a Man in the Middle attack. In any case it was enough to cause a signature mismatch.
My solution was to rip out the ELB, as we don’t really need it in this case and were just experimenting. If you have a similar setup, perhaps with HAProxy or something similar, and you figure out how the get everything working, please leave a comment. I’d love to make everyone play nice together, but for now I’m just happy to have a working OAuth provider.
Note: For historical purposes, here are the versions I am using:

  • Ruby v1.9.3
  • Rails v3.0.12
  • oauth gem v0.4.6
  • oauth-plugin gem v0.4.0