Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I had the exact same issue so I hope my solution will be helpful.</p> <p>Based off the details in your question I am assuming you following the OmniAuth guide in the devise wiki: <a href="https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview" rel="noreferrer">https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview</a></p> <p>In the following method:</p> <pre><code>def self.find_for_facebook_oauth(access_token, signed_in_resource=nil) data = access_token.extra.raw_info if user = User.where(:email =&gt; data.email).first user else # Create a user with a stub password. User.create!(:email =&gt; data.email, :password =&gt; Devise.friendly_token[0,20]) end end </code></pre> <p>I changed the logic in the else block because it was creating a new user in the database right away and hashing a password for them:</p> <pre><code>else # Create new user user =User.new user end </code></pre> <p>Instead I just made a new user so that after getting the facebook info I direct them to the sign up page where I have their info populated in the form fields where they can edit and create a password.</p> <p>You will just need to make sure to update your </p> <pre><code>def self.new_with_session(params, session) </code></pre> <p>to add all the relevant facebook information you grabbed for a new user and assign it to the new user object so all those fields are populated with their information in the sign up page. So that after they finish typing their password and adding or changing any info and click submit it create the new user. Hopefully you find this helpful.</p> <p>This was a mash of ideas for the wiki page on Devise and the railscast omniauth tutorial: <a href="http://railscasts.com/episodes/235-omniauth-part-1" rel="noreferrer">http://railscasts.com/episodes/235-omniauth-part-1</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload