omniauth

How to set facebook authentication keys depending on environment?

寵の児 提交于 2019-12-03 15:30:16
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_secrets which my Rails application needs to use. How do I set OmniAuth to use one set of keys in the

Rails omniauth - twitter asking for app authorization each time user logs in

强颜欢笑 提交于 2019-12-03 14:48:44
问题 In Railscast: http://railscasts.com/episodes/241-simple-omniauth Ryan uses omniauth for logins. In the video when he clicks on the login button the first time Twitter asks the user if they would like to authorize Ryan's app. The second time the login button is clicked it automatically logs the user in. In my application, the user is forced to authorize my app each time. If the user is logged into twitter and has already authorized the app, then shouldn't it "just work"? EDIT: my app currently

OmniAuth before_filter for requiring login

橙三吉。 提交于 2019-12-03 14:17:47
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? 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/facebook" %> See also RailsCasts tagged with authentication 来源: https://stackoverflow.com/questions/4477745

How to use omniauth to make authenticated calls to services?

旧街凉风 提交于 2019-12-03 13:02:17
I've received a token / secret from a service using OmniAuth and can store it for users, but I'm stuck as to how to actually use these to call a service. The closest thing I've seen to this question is here but the way he's solved that there doesn't feel right. I feel like OmniAuth likely does this all for you if you know what you're doing. Netflix has a pretty involved auth process , so I was hoping to skirt all of this by using OmniAuth to abstract me from all of this. Given that I have a token and secret for a user, how to use these in calling a service like Netflix? Many thanks :) Hey, I'm

SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A - Faraday::Error::ConnectionFailed

浪子不回头ぞ 提交于 2019-12-03 12:40:46
问题 I've seen many answers here, but none of them has worked. I'm using omniauth-oauth2 gem to integrate with a third-party customer. I'm using the setup phase described here but I'm always getting this error: Authentication failure! failed_to_connect: Faraday::Error::ConnectionFailed, SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A Faraday::Error::ConnectionFailed (SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A): .rvm/rubies/ruby-2.0.0-p247

OmniAuth Facebook expired token error

大兔子大兔子 提交于 2019-12-03 10:17:45
问题 I am using OmniAuth to get access to Facebook in my app. I am using the fb_graph gem: https://github.com/nov/fb_graph to post to Facebook. I am running omniauth-0.3.0 on Heroku for this app. The token that I save when the user is created is changed when the user logs in sometime later. Code for creating user class SessionsController < ApplicationController def create auth = request.env["omniauth.auth"] user = User.find_by_provider_and_uid(auth["provider"], auth["uid"])|| User.create_with

Display a Twitter feed from a Rails app

僤鯓⒐⒋嵵緔 提交于 2019-12-03 09:59:31
问题 I have been able to have a user sign in with Twitter via OmniAuth (I followed Railscast #235-6 and made a simple application). Now I am trying to display the Twitter feed of the logged in user. Can anyone tell me how this is done? How do I initialize Twitter? How do I pass in the username and password of the logged in user? I am new to Rails so it would be helpful if I knew exactly where to put the code. Thanks 回答1: First, you don't need user credentials to get a Twitter feed if it's public.

Devise Omniauth “encrypted_password may not be NULL” for new user

∥☆過路亽.° 提交于 2019-12-03 09:43:15
问题 I am using Devise with Omniauth to have users sign into my app with Facebook. I used the Railscast tutorials to get it up and running. If a user is already a member of my site authenticating through facebook works fine. The problem comes in when authenticating a new user with facebook. When it goes to create a new user for my User model I get the "users.encrypted_password may not be NULL" error. I can't figure out how to pass over the password to the User model from Facebook information. This

How can I specifiy what access I need from my user's Facebook accounts when using OmniAuth?

只愿长相守 提交于 2019-12-03 08:49:35
When you use OmniAuth to login to a web app through Facebook, these are the permissions the webapp has: Access my basic information Includes name, profile picture, gender, networks, user ID, list of friends, and any other information I've shared with everyone. Send me email WebApp may email me directly at email@email.com Access my data any time WebApp may access my data when I'm not using the application Whereas when you use the mini_fb gem to link a web app to Facebook, these are the permissions (have to specify this as code otherwise formatting was weird): Access my basic information

generate unique username (omniauth + devise)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 08:39:43
I have an app with user authentication with devise + omniauth. In my model that username in my app is unique . I dont want duplicate username in my app. Some users in facebook has not a defined username in his profile. I want generate an unique username if the user has not username defined in facebook. For example for generate password I have this: :password => Devise.friendly_token[0,20] How can I generate a unique username for my app if the facebook user has not username in facebook? Thank you You can take a part of email before the @ sign and add there smth like user_id, or just take the