omniauth

Allowing Curl API access to Rails web app with OmniAuth

橙三吉。 提交于 2019-12-10 10:27:35
问题 I'm building a Rails web app. I use OmniAuth for authentication. I would like to provide API access but only after the user has authenticated themselves with OAuth (via twitter mainly). Any suggestions of where to start? EDIT: add more context as requested Not trying to become an Oauth provider, but simply use the same login tokens. For example, you log into my app through twitter. You have both the token and secret OAuth tokens. I want to use those tokens to allow a user API access to the

Devise + omniauth + carrierwave doesn't save facebook profile image

泪湿孤枕 提交于 2019-12-10 10:25:02
问题 I am using devise with omniauth facebook. I upload avatars for people that are not signing in with facebook with carrierwave, with the AvatarUploader. But when I try fetching the avatar from the facebook user, it does not save - user.avatar = auth.info.image does not save, and after signing in equals nil . Why is that and how can I fix it? Thanks in advance. def self.from_omniauth(auth) where(auth.slice(:provider, :uid)).first_or_create do |user| user.provider = auth.provider user.uid = auth

How do I have devise / omniauth redirect to the page from which I signed in from?

别等时光非礼了梦想. 提交于 2019-12-10 10:19:54
问题 I have the authentication through omniauth and that link is available on every page through layout/application.html.haml. However, when they complete the omniauth authentication, they all go to root. How can I set it up so they redirect to the actual page from which they clicked on the authentication link (which takes them to the oauth provider). Thanks 回答1: You can use request.env['omniauth.origin'] . See https://github.com/intridea/omniauth/wiki/Saving-User-Location 回答2: I see two options

OmniAuth dynamic callback url to authenticate particular objects instead of current_user

心不动则不痛 提交于 2019-12-10 10:03:29
问题 Say I have the models User and Project. Users and projects are HABTM-associated. My setup is actually a bit more complicated than this, but I think for the purposes of my question this will do. Now, I want to use omniauth to authenticate a particular project with Twitter, Facebook, what have you. I've figured out how to define my omniauth path_prefix, but I don't know how I could pass in a variable like so: config.path_prefix = 'projects/:project_id/auth' , much less make a custom callback

How to override gem dependency?

雨燕双飞 提交于 2019-12-10 04:34:14
问题 I have 2 gems that depend on conflicting versions of hashie (one requires ~> 1.2.0 and the other requires 3.3.1): Bundler could not find compatible versions for gem "hashie": In Gemfile: restforce (>= 0) ruby depends on hashie (~> 1.2.0) ruby omniauth (>= 0) ruby depends on hashie (3.3.1) I'd like to keep both gems and use the higher version of hashie. Is there a way for me override one of the gem dependencies? 回答1: The standard advise is to use the higher version compatible . I do this way,

Google OAuth 2 redirect_uri_mismatch - OmniAuth Rails app

萝らか妹 提交于 2019-12-10 02:04:26
问题 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?

Redirect to Page after Facebook Sign Up

时间秒杀一切 提交于 2019-12-09 21:15:00
问题 I'm trying to Redirect a user after successful Facebook SIGN UP (not sign in). I want to redirect to /getstarted/welcome after a user Registers for the first time . My omniauth callback is : def facebook # You need to implement the method below in your model (e.g. app/models/user.rb) @user ||= User.find_for_facebook_oauth(request.env["omniauth.auth"], current_user) if @user.persisted? # This will throw if @user is not activated sign_in_and_redirect @user, event: :authentication if is

Facebook Redirect url in ruby on rails open ssl error

怎甘沉沦 提交于 2019-12-09 11:12:44
问题 I have followed the omniauth devise facebook app as explained by Ryan in episode 235.After the user authorizes we are getting the error at http://localhost:3000/auth/facebook/callback?code=13444... The following are the facebook settings : App Domain : localhost siteurl: locahost:3000/ canvas url: http://localhost:3000/auth/facebook/ please tell me where am i going wrong? 回答1: In one project, we had to add this code to config/environments/development.rb to get Facebook connect working for

OmniAuth - current session not loaded on OpenID callback

南笙酒味 提交于 2019-12-09 10:03:45
问题 I'm using OmniAuth with Rails 3.1.4 and I'm trying to allow already authenticated users to associate multiple OpenID providers with their account. As an unauthenticated user, signing in with OpenID works fine. As an authenticated user, when I try to sign in with a different oid provider, when the callback method is executed, it just looks like I wasn't previously authenticated. To me it just looks like the controller gets executed before sessions are initialised (or sessions are completely

Deprecated offline_access on facebook with RoR

我的梦境 提交于 2019-12-09 06:25:12
问题 We have a problem in our RoR app. We are using a facebook authentication with omniauth, and searching the user friends with Koala. But lately, when we try to show a friend photo, we got this error: Koala::Facebook::APIError in Homes#show Showing /home/daniel/Homes/app/views/shared/_event.html.erb where line #19 raised: OAuthException: Error validating access token: Session has expired at unix time 1328727600. The current unix time is 1328802133. Extracted source (around line #19): 16: <img