omniauth

Devise with Omniauth for multiple models without STI

孤街浪徒 提交于 2019-12-01 15:51:09
Is there any way to configure Devise Omniauth for multiple models without STI? We have the models Students and Professors and we didn't want to use STI but now we realized that Devise with Omniauth doesn't play well with multiple models. .rvm/gems/ruby-1.9.3-p125/gems/devise-2.1.0/lib/devise/rails/routes.rb:384:in `devise_omniauth_callback': Wrong OmniAuth configuration. If you are getting this exception, it means that either: (RuntimeError) 1) You are manually setting OmniAuth.config.path_prefix and it doesn't match the Devise one 2) You are setting :omniauthable in more than one model 3) You

Devise with Omniauth for multiple models without STI

依然范特西╮ 提交于 2019-12-01 14:59:10
问题 Is there any way to configure Devise Omniauth for multiple models without STI? We have the models Students and Professors and we didn't want to use STI but now we realized that Devise with Omniauth doesn't play well with multiple models. .rvm/gems/ruby-1.9.3-p125/gems/devise-2.1.0/lib/devise/rails/routes.rb:384:in `devise_omniauth_callback': Wrong OmniAuth configuration. If you are getting this exception, it means that either: (RuntimeError) 1) You are manually setting OmniAuth.config.path

Twitter::Error::Unauthorized in PostsController#create - Invalid or expired token

Deadly 提交于 2019-12-01 12:37:16
Why does "create" throw me an invalid/expired token error? The users are able to log in just fine (so they are authenticated properly) but when they try to create a post, I get this error. I'm using Omniauth gem (v1.1.4) for authentication and Twitter gem (v4.6.2) for the posting to Twitter. The Omniauth-twitter gem is v0.0.16 if that matters. This is the code that is causing me an error class PostsController < ApplicationController def create Twitter::Client.new.update(@post.content) end end This is part of the user model (user.rb) def twitter unless @twitter_user provider = self

How do I fix this gem dependency problem in Rails 3 (bundler)?

橙三吉。 提交于 2019-12-01 11:01:12
For some reason, my project has messed up and now its throwing errors every time I try to run bundle install . Somem of the errors i've managed to fix by reordering the gems in my Gemfile , but now i'm getting this one: Bundler could not find compatible versions for gem "faraday": In Gemfile: omniauth depends on faraday (~> 0.7.3) twitter depends on faraday (0.6.1) I thought that using bundler was supposed to erase dependency wtf's ? I'm assumingn this message means that two gems want 2 different versions of faraday ..? How can I fix this problem though? Why doesn't it just install both

How do I mock an OmniAuth hash using Rails and minitest?

这一生的挚爱 提交于 2019-12-01 09:24:29
I'm using Rails 5 with minitest. I want to mock logging into my sessions controller, which relies on omniauth (I use Google and FB for login). I have this in my controller test, test/controllers/rates_controller_test.rb, class RatesControllerTest < ActionDispatch::IntegrationTest # Login the user def setup logged_in_user = users(:one) login_with_user(logged_in_user) end and then I try and set up login in my test helper, test/test_helper.rb, class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. fixtures :all def setup_omniauth_mock(user)

How do I mock an OmniAuth hash using Rails and minitest?

僤鯓⒐⒋嵵緔 提交于 2019-12-01 05:40:50
问题 I'm using Rails 5 with minitest. I want to mock logging into my sessions controller, which relies on omniauth (I use Google and FB for login). I have this in my controller test, test/controllers/rates_controller_test.rb, class RatesControllerTest < ActionDispatch::IntegrationTest # Login the user def setup logged_in_user = users(:one) login_with_user(logged_in_user) end and then I try and set up login in my test helper, test/test_helper.rb, class ActiveSupport::TestCase # Setup all fixtures

Rails session gets destroy whenever model destroy link is clicked

落花浮王杯 提交于 2019-12-01 04:31:38
If I click destroy on any record for my 3 models models, the user gets logged out. I'm using Devise and Ominauth. #This logs out a user def destroy @rating = Rating.find(params[:id]) @rating.destroy end Started POST "/ratings/29" for 192.168.1.103 at 2011-02-26 20:11:45 +0000 Processing by RatingsController#destroy as HTML Parameters: {"id"=>"29"} User Load (0.5ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2 LIMIT 1 Rating Load (0.3ms) SELECT `ratings`.* FROM `ratings` WHERE `ratings`.`id` = 29 LIMIT 1 SQL (0.0ms) BEGIN AREL (0.5ms) DELETE FROM `ratings` WHERE `ratings`.`id` = 29 SQL

Authentication failure : Devise + OmniAuth + Twitter

筅森魡賤 提交于 2019-12-01 04:05:44
I am getting (twitter) Authentication failure! invalid_credentials: OAuth::Unauthorized, 401 Unauthorized error after successfully loin to twitter and page is redirected to sign in page Here is the application configuration routes.rb devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } devise.rb config.omniauth :twitter, "KEY", "SECRET" omniauth_callbacks_controller.rb class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController def twitter auth = env["omniauth.auth"] Rails.logger.info("auth is **************** #{auth.to_yaml}") @user =

Rails session gets destroy whenever model destroy link is clicked

心不动则不痛 提交于 2019-12-01 03:04:06
问题 If I click destroy on any record for my 3 models models, the user gets logged out. I'm using Devise and Ominauth. #This logs out a user def destroy @rating = Rating.find(params[:id]) @rating.destroy end Started POST "/ratings/29" for 192.168.1.103 at 2011-02-26 20:11:45 +0000 Processing by RatingsController#destroy as HTML Parameters: {"id"=>"29"} User Load (0.5ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2 LIMIT 1 Rating Load (0.3ms) SELECT `ratings`.* FROM `ratings` WHERE `ratings

Facebook app - login through omniauth - OAuthException 191

房东的猫 提交于 2019-12-01 02:39:01
I am facing with the problem: "error": { "message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.", "type": "OAuthException", "code": 191 } I set up in my app the needed keys and tokens, in the Facebook's dev center I set up Site URL: to http://127.0.0.1:3001 and I am getting the error above. Also I tried to set up App Namespace: to http://127.0.0.1:3001 , but I am getting error about bad address format... When I tried to fill out he App Domain: and set there my localhost, again the error for the bad format... What is the correct configuration the fabebook