Rails Engine + omniauth-google-oauth2 + Devise gem - ruby-on-rails

Am writing a rails app and a engine. Engine contains Authentication and Authorization process (Here am using GMail login- google_oauth2 gem). After Successful login i have to start session using Devise gem then i have to redirect to sample app.
Problems:
How can i start session after Success message from google? because
here i have to use Devise for session.
What are all the parameters i have to send to devise then how to call
devise's session controller from my engine?
Is there any tutorial to add devise with engine(google-oauth2
gem) please provide links.
If question not clear please tell me i will provide some more details

Related

Devise + Patreon OAuth in Ruby on Rails

I have implemented the devise+patreon gem in my Rails application without issues. Now, devise requires an email/password by default when creating a User, but Patreon just uses the oauth integration.
I am wondering, what is the proper strategy to use so that I can migrate the Patreon Oauth users as Devise users, without having to set dummy passwords/emails to allow for validation to go through. I still want to eventually allow users to register via Devise natively, as well as through Patreon.
Is there maybe a known strategy/gem/addition for devise that I may have missed that can easily achieve that?
You can retrieve the user email and a lot of other infos (see here) about the user in the login call to patreon's services, but password will remain unknown, you can't just copy & paste a User.

Register with a username using Ruby on Rails Devise Gem

Using Devise Gem, I was able to sign in and register via email, but how can I login with username?How can I add validation to a username?
Check devise wiki, should be enough to solve this.
https://github.com/heartcombo/devise/wiki/How-To:-Allow-users-to-sign-in-using-their-username-or-email-address

Is this the correct way for only allowing logins via Devise + Omniauth in Rails 4?

I wanted to allow users to signup + login to a Rails app via omniauth only, no email / password sign up / login should be allowed So I looked at this answer, but that didn't work. So I ended up generating customized views for registrations and sessions and commenting out email/password fields in the login + signup forms.
Then in config/initializers/devise.rb I set:
config.params_authenticatable = false
Is this the best way to do it?
I believe there isn't a very "clean" way to do this, because Devise is a very complete solution.
Please take a look here: Using only omniauth (twitter) sign-in with Devise, Rails 3, Omniauth
IMO, if you need just oauth authentication, maybe devise is too much for this. This Railscast may help you as well: Simple OmniAuth

LDAP Authentication with Refinery CMS

I'm attempting to use devise_ldap_authenticatable with Refinery CMS. I've overriden Refinery's user model and changed its call to devise, and added in a devise initializer to configure it.
The path to my LDAP config is correct in the initizlier, but I don't think it's being utilized. I get a Sorry, your login or password was incorrect. error whether the config is there or not.
I'm not sure what else do at this point. I have a simple devise app with devise_ldap_authenticatable that I'm able to authenticate with. I just can't seem to get it work with the Refinery app.

Devise access params in Devise sessions view

I'm on Rails 3.0.9, Ruby 1.9.2, Devise 1.3.4
URL to an authenticated Devise resource for my app, e.g.,
http://myblog.com/article/5?type=blah
This will cause Devise to redirect to a login page. I have a need on Devise login page, sessions#new.html.erb, to conditionally display a drop down depending on type and I have no idea how to access it from sessions#new.html.erb. I tried params and that didn't work, ideas?
I found a workaround, Devise stores that info in a session variable
session[:user_return_to]
Hope this helps someone else out of a jam if they need to do the same thing

Resources