401 Unoauthorized With OmniAuth Twitter and Pow Domains
As stated a few posts back, I have switched to using Pow for managing my hosts configuration.
Recently, I was using
omniauth-twitter to authenticate a client for my Rails
application. When trying to access the application’s oauth url for twitter, i.e.
/auth/twitter via the pow based domain I was getting a
error, while accessing it via the Webrick’s
http://localhost:3000 worked fine.
I was scratching my heads over the reason, when I noticed that I was using
Environment variables in my provider definition, and I wondered probably Pow
does not have access to these variables? I use
dotenv and was pretty sure
webrick had access to these Environment variables.
So, I googled for a while and found that Pow actually does not have access to
dotenv based variables. Instead, it does allow setting them via a
file. Therefore, I ran the following commands to configure all this from my
Rails’ root path:
1 2 3
And, voila! I can now access my oauth workflow, simply.