简体   繁体   中英

401 Unauthorized using OmniAuth-Twitter

I am getting a 401 Unauthorized when trying to implement the OmniAuth-Twitter gem into my rails app in Development I have read several posts saying the server times are mismatched.

The error comes when calling http://localhost:3000/auth/twitter

I have a callback url. I have the api keys correct. So I assume the timestamp is the issue.

How exactly can I go about comparing twitter's server time to my local machine's time?

How do I go about adjusting my local machine's time?

I was following this railscasts episode . In it he states to set the keys like:

Rails.application.config.middleware.use OmniAuth::Builder do
   provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
end

But the gem documentations states:

Rails.application.config.middleware.use OmniAuth::Builder do
   provider :twitter, "CONSUMER_KEY", "CONSUMER_SECRET"
end

Removing the ENV[] solved the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM