omniauth

local variable or method `config' for main:Object (NameError)

不打扰是莪最后的温柔 提交于 2019-12-05 05:37:40
I'm following this post for integrating Omniauth Twitter + Devise http://sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin/ and I have encounter an issue that is blocking me to start my rails app. /Users/javier/Desktop/definitive/config/environment.rb:8:in `<top (required)>': undefined local variable or method `config' for main:Object (NameError) from /Users/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' from /Users/javier/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in

Omniauth authorization call with Ajax

不问归期 提交于 2019-12-05 04:41:05
I have omniauth working fine in my Rails 3 app when using it as a link: link_to("Connect Twitter", "/auth/twitter", :id => "connect-to-twitter") Now I want to call '/auth/twitter' through ajax. However, nothing is returned after the request phase. Here is the last log entry: Started GET "/auth/twitter" for 127.0.0.1 at 2012-10-30 17:53:02 -0700 (twitter) Request phase initiated. Here is my ajax code (in Coffeescript): $("#connect-to-twitter").live("click", -> alert('get twitter') $.get('/auth/twitter', (data) -> alert(data) ) return false ) (I know this question has been asked before here, but

Devise, Omniauth and Twitter

跟風遠走 提交于 2019-12-05 03:01:38
问题 I'm working on a Rails 3 app that uses devise and omniauth and followed the examples given in https://github.com/plataformatec/devise/wiki/OmniAuth%3A-Overview and it worked well for Facebook accounts, but when I tried adding Twitter auth, I get a '401 Unauthorized' response. To track the problem down I switched the URL for api.twitter.com to http and dumped the network traffic and it looks like it's POSTing to /oauth/access_token twice. The first time I get a 200 response, the second gives

Rails rspec and omniauth (integration testing)

余生颓废 提交于 2019-12-05 02:01:49
My Rails 3.2 app uses OmniAuth and Devise to sign in with Twitter. The authentication system works fine. I would like to write an integration test in rspec to make sure everything works. Using the information in the wiki, I've written the following, but I know I'm missing things. Under test.rb in config/environments, I have the following lines OmniAuth.config.test_mode = true OmniAuth.config.mock_auth[:twitter] = {:provider => 'twitter', :uid => '123545'} My rspec test looks like this: describe "Authentications" do context "without signing into app" do it "twitter sign in button should lead to

Google OAuth 2 redirect_uri_mismatch - OmniAuth Rails app

别等时光非礼了梦想. 提交于 2019-12-05 01:37:00
I've a problem with authenticating Google account with my Rails app. I'm using omniauth-google-oauth2 gem with Devise. Always get this Error when I try to access google account: Error: redirect_uri_mismatch The redirect URI in the request: http://localhost:3000/users/auth/google_oauth2/callback did not match a registered redirect URI I'm sure that the registered redirect URI in my google console app is right and identical with requested one, just like that: so what's main the problem here? try this way : add require "omniauth-google-oauth2" to devise.rb in config/initializers folder add http:/

How to handle OmniAuth callbacks in multiple environments?

不羁的心 提交于 2019-12-05 01:28:45
问题 I have an app that uses Facebook exclusively as a provider for authentication and have correctly setup the callback for production mode. In order for this to work, you provide your Facebook app with a site URL and a site domain for callbacks, and in my case it's http://appname.heroku.com and appname.heroku.com respectively. The problem is that my controllers are setup to only allow authenticated sessions so I cannot view my app in development mode because the Facebook app's domain obviously

Devise/Omniauth failure: How to debug it?

♀尐吖头ヾ 提交于 2019-12-05 00:07:15
After trying to "log in with Google", I'm seeing this error in the logs: Processing by Users::OmniauthCallbacksController#failure as HTML I can see all the data from google being sent through the URL (in the logs), including user email and name. So what could go wrong? My callbacks aren't even being executed. I only get redirected to the sign_in page of my site. And I'm pretty sure everything is configured correctly, because this was working fine some weeks ago. I don't think I changed anything. Facebook login still works fine. Any ideas on how to debug this failure? There is nothing else in

OmniAuth before_filter for requiring login

折月煮酒 提交于 2019-12-04 23:58:25
问题 is it possible using OmniAuth to require login before certain actions? I remember from a railscast that Devise has a before_filter, but does OmniAuth? 回答1: You can add a before_filter : class ApplicationController < ActionController::Base before_filter :authenticate def authenticate redirect_to :login unless User.find_by_provider_and_uid(auth["provider"], auth["uid"]) end ... end Presuming: 1. You have defined a login page with link(s) like : <%= link_to "Sign in with Facebook", "/auth

How to set facebook authentication keys depending on environment?

流过昼夜 提交于 2019-12-04 22:03:14
问题 I have a rails app which uses omniauth to authenticate visitors via facebook. When you register an app with facebook, you have to register a callback url which they will redirect to once they have completed their authentication process. Since my production site is hosted on a different server than my development environment, I need to register 2 different urls with Facebook. I've done this by registering two apps, a live one and a dev version. Now of course I have two app_ids and two app

Omniauth “with” STI and devise

北战南征 提交于 2019-12-04 20:57:41
I'm figured out with no results. I have a model named User and to models with STI fan and artist, like this: class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :confirmable, :lockable, :recoverable, :rememberable, :trackable, :validatable, **:omniauthable** end and my others models Class Artist < User end Class Fan < User end my routes devise_for :users devise_for :artists devise_for :fans I have a problem when try to run my server or anything else i got this error Wrong OmniAuth configuration. If you are getting this exception, it means that either: 1) You are