omniauth

what is the omniauth & email-password registration best practice?

只谈情不闲聊 提交于 2019-12-04 10:19:56
What is the best practice for combining Facebook login (let's say I'll use Omniauth gem) and email+password login? I saw a few blogs, saw the Railscasts, I know everyone is using Devise gem with Omniauth. But I'm looking for some different perspective. subquestions: I'm considering creating email+password sign-up from scratch (not using any gem for this, lets keep it fast and light) so do you have any advice for this ? Or if you have particular gem in mind, please let it be fast. And do you have any other recommendations for Oauth2 gems (alternative to Omniauth) handling authentication to

How to rescue OmniAuth::Strategies::OAuth2::CallbackError?

自作多情 提交于 2019-12-04 07:41:04
问题 I am building a Rails application with Omniauth for log in service.To authenticate Google I am using OmniAuth Google OAuth2 Strategy. When user clicks 'allow access' button everything works fine.But when user clicks 'no thanks' button the below error is raised. OmniAuth::Strategies::OAuth2::CallbackError I have tried adding the below rescue code in application controller. class ApplicationController < ActionController::Base rescue_from OmniAuth::Strategies::OAuth2::CallbackError, :with =>

How to use http authentication in devise with an optional omniauth token as the authentication token

陌路散爱 提交于 2019-12-04 07:29:11
问题 We have a rails app setup that uses devise & omniauth to allow logging in via facebook authentication. We also have a mobile app that is currently using http authentication to login to the rails app either by passing username & password or by passing in the http authentication token. This all works great so far. The mobile app also has the ability to authenticate with facebook itself and receive the user facebook token directly between itself and facebook. I would like to bridge this gap so

How to use YML values in a config/initializer

偶尔善良 提交于 2019-12-04 04:36:57
I'm working to integrate facebook in my app. To do that I'm using koala, devise, and omniauth. For koala, I have /config/facebook.yml development: app_id: 123123132123 secret_key: dasadsasd1231231 test: app_id: 313131313 secret_key: das132asdads12132 production: app_id: dasdsadsadsadsa secret_key: adsdsa12das123fds21 I then also have with omniauth: /config/initalizers/omniauth.rb Rails.application.config.middleware.use OmniAuth::Builder do provider :facebook, 123123132123, 'dasadsasd1231231' end Problem here is I have the same value repeated in both locations. How can I dry this up so that the

Rails, Devise & Omniauth - problems with setup

梦想的初衷 提交于 2019-12-04 02:59:43
问题 I am trying (again) to set up authentications with Rails 4, devise and omniauth. I tried to follow the example in this post: Rails 4, Devise, Omniauth (with multiple providers) I have these gems installed: gem 'devise' gem 'omniauth-google-oauth2' gem 'omniauth-facebook' gem 'omniauth-twitter' gem 'omniauth-linkedin-oauth2' gem 'oauth2' I have a user model, and an authentications model. I have: User.rb: has_many :authentications def disapprove self.approved = false end def approve self

How to change route of omniauth from /auth/:provider to /myapp/auth/:provider

半城伤御伤魂 提交于 2019-12-04 00:26:44
How can I change the route that triggers omniauth from using /auth/:provider to /myapp/auth/:provider ? I don't want to redirect either, because my server will send anything that's not in /myapp/ to the wrong place. You can change it via :setup option Source: https://github.com/omniauth/omniauth/blob/e9978e377f1ac2b7271e5a8486dfe103a1c1d48d/lib/omniauth/strategy.rb#L304-L307 Here is how I did this in the config.ru file. I my case, my provider is CAS . use OmniAuth::Builder do configure do |config| config.path_prefix = '/my-app-path/auth' end provider :cas, CAS::OPTIONS end Note that CAS:

Remove '#_=_' from the Facebook redirect URL [duplicate]

穿精又带淫゛_ 提交于 2019-12-03 23:23:59
This question already has answers here : Closed 6 years ago . Facebook Callback appends '#_=_' to Return URL (21 answers) According to https://developers.facebook.com/blog/post/552/ the FB Graph API now appends a _=_ hash to the end of the URL it redirects back to when redirect_uri is not set. However, it is still appending it even though my call specifies the redirect_uri . Short of redirecting again after FB returns to my site, how can I get FB to stop appending the hash? PS - the hash is breaking backbone.js and I need it gone. This isn't just a pet peeve. http://developers.facebook.com

undefined method `session_path'

末鹿安然 提交于 2019-12-03 22:24:54
I am using Rails + Devise + OmniAuth + Google OAuth2. My user model (user.rb) contains: devise :registerable, :omniauthable, :omniauth_providers => [:google_oauth2] My routes.rb look like: Rails.application.routes.draw do devise_for :users, controllers: { omniauth_callbacks: 'omniauth_callbacks' } devise_scope :user do get 'sign_in', :to => 'devise/sessions#new', :as => :new_user_session post 'sign_in', :to => 'devise/session#create', :as => :user_session get 'sign_out', :to => 'devise/sessions#destroy', :as => :destroy_user_session end get 'services', to: 'static_pages#services' get 'my

omniauth-devise error: “Validation failed: Email has already been taken”

女生的网名这么多〃 提交于 2019-12-03 17:33:59
I am trying to create a rails 4 app with omniauth devise : signin with facebook signin with google signin with linkedin signin with twitter Here, I am able to login in with either facebook, linkedin, twitter or google account. But my problem is: my google account email and linkedin email address are same. And login with google and then login with linkedin is giving me this error: "Validation failed: Email has already been taken" This is a problem because devise uses :unique => true in migration file for email field. Can anyone provide me nice idea to handle this error please? I think that

Devise, Omniauth and Twitter

血红的双手。 提交于 2019-12-03 17:33:41
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 the 401. In between it successfully gets user info for the authenticated user using 'GET /1/account