omniauth

Save user's gender and location from youtube login OAuth

核能气质少年 提交于 2019-12-12 02:09:26
问题 I have youtube login setup with OAuth2 and upon a successful user registration I would like to save the users gender and location in the database. Checking the OAuth docs https://developers.google.com/accounts/docs/OAuth2Login#userinfocall you can see that you can access a users gender and location along with things like name, email and their profile picture. Below is my code for saving a users info to the db user.rb def self.from_omniauth(auth) where(auth.slice(:provider, :uid)).first_or

Authentication failure: omniauth

﹥>﹥吖頭↗ 提交于 2019-12-12 01:42:58
问题 I am following the below tutorial of omniauth-facebook for configuring the authentication method from facebook in my rails application: http://railscasts.com/episodes/360-facebook-authentication Everything is running fine but after callback I'm getting the following error: undefined method `from_omniauth' for #<Class:0x007ff05a58de30> and the code snippet: class SessionsController < ApplicationController def create user = User.from_omniauth(env["omniauth.auth"]) #Highligted line as red

Enabling users to enter their email when they login with Twitter (OmniAuth)

筅森魡賤 提交于 2019-12-12 01:33:25
问题 I'm using omniauth-twitter and I have everything set up: user.rb: def self.create_with_omniauth(auth) create! do |user| user.provider = auth["provider"] user.uid = auth["uid"] user.name = auth["info"]["name"] user.email = auth["info"]["email"] # To pass password validation user.password = user.password_confirmation = SecureRandom.urlsafe_base64(n=6) end end sessions_controller.rb: def create user = User.find_by_email(params[:session][:email].downcase) if user && user.authenticate(params[

How to authenticate two types of user with same authentication callback in rails?

痴心易碎 提交于 2019-12-11 17:24:32
问题 I want to create a webpage using rails 6.0.0, which has two types of users(model) Admin User/viewer But the problems is that I want to authenticate (sign up /sign in) for both users with facebook or google_oauth2 with same callbacks address: /auth/:provider/callback On internet, github and youtube I have found articles and videos only for authenticate single model. But I want to authenticate (sign up /sign in) for two models. Can anyone help? Please give an idea to authenticate both model

Restrict Login with Google OAuth2.0 and Devise to Specific Whitelist Table using Ruby

一曲冷凌霜 提交于 2019-12-11 16:21:22
问题 So I was trying to use omniauth2 to check if the email had the right @domain.com but I think using a database table will allow more functionality as well as being more secure and such. My previous question: Restrict Login with Google OAuth2.0 to Specific Whitelisted Domain Name on Ruby I think I want to use a database table to check the email that google authenticated against a whitelist of emails, is there anyway to do this with devise and omniauth2? That way I can say only certain users are

Rails 3.2 Omniauth Devise - Add password - Skip current password

五迷三道 提交于 2019-12-11 14:48:07
问题 I'm using Omniauth to allow users to sign in (and create an account) through Facebook, Twitter, and Google. However, if a user decides to not use those services anymore, but continue to use their account, they will want to add a password. How can I let a user add a password to their account without entering a current password ?* When I let a user go to the edit_user_registration_path(@user) , they see the form below: = form_for(resource, as: resource_name, url: registration_path(resource_name

OmniAuth: redirect to page which requires authentication instead of the one which user came from

烈酒焚心 提交于 2019-12-11 14:24:03
问题 There are some pages in my app which require authentication with linked in. I use before filter to redirect user to /auth/linked_in if s/he is not already authenticated. I want that after authentication user should be redirected to page which required authentication instead of page from which user came from. Before filter looks like: def require_linked_in! unless current_user and current_user.linked_in_authenticated? redirect_to "/auth/#{Authentication::LINKED_IN}" end end In my omniauth

authlogic UserSession.create(@user) giving unauthorized_record

独自空忆成欢 提交于 2019-12-11 14:17:56
问题 I am trying to create a session explicitly like this UserSession.create(@user, true) but the session is not getting created, current_user is nil . But when I do this, I get < #UserSession: {:unauthorized_record=>""}> us = UserSession.create(@user, true) RAILS_DEFAULT_LOGGER.info(us.inspect) #=> UserSession: {:unauthorized_record=>""} I had a look at Authlogic::Session::UnauthorizedRecord here it says Be careful with this, because Authlogic is assuming that you have already confirmed that the

How to check if user is signed in with omniauth

蓝咒 提交于 2019-12-11 13:53:39
问题 I have a app running on devise and omniauth for user registrations. However when someone logins with facebook using omniauth I want to display some extra info for that user. However I can't find a way to identify if that user is signed in with facebook. I believe it has something to do with the devise_helper (user_signed_in?) but I'm not sure how to use it with omniauth. user.rb def self.find_for_facebook_oauth(auth) where(auth.slice(:provider, :uid)).first_or_initialize.tap do |user| user

OAuth::Unauthorized 400 error with Google+ login API

限于喜欢 提交于 2019-12-11 13:39:15
问题 I'm trying to set up Google+ login with Devise and omniauth in an app I'm working on and running into an OAuth::Unauthorized 400 error. I'm using the omniauth-google gem. My Devise config sets up omniauth for Google: config.omniauth :google, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET'], scope: 'plus.login' I'm running the site locally on dev.app.com:3000, and in my app settings in the Google Developers Console I've set the JavaScript origin to be http://dev.app.com:3000 and the redirect URI to be