title: Authlogic Create new session without password
body: <p>I'm trying to build Facebook OAuth into my existing Authlogic login system. I have the OAuth part complete, and stored the facebook access_token. The problem I'm facing is to actually log the user in (create a session) without the user typing in their password.</p>
  
  <pre><code>  #facebook's OAuth callback
    def callback 
      access_token = client.web_server.get_access_token(params[:code], :redirect_uri =&gt; redirect_uri)
      fb_user = JSON.parse(access_token.get('/me'))  
      @user = User.find_by_facebook_id(fb_user["id"]) || User.find_by_email(fb_user["email"]) || User.new
      @user.update_attributes({
        :facebook_id =&gt; fb_user["id"],
        :first_name =&gt; fb_user["first_name"],
        :last_name =&gt; fb_user["last_name"],
        :gender =&gt; fb_user["gender"],
        :email =&gt; fb_user["email"],
        :timezone =&gt; fb_user["timezone"],
        :locale =&gt; fb_user["locale"],
        :facebook_url =&gt; fb_user["link"],
        :facebook_access_token =&gt; access_token.token
      }) #unless @user.updated_at &lt; 2.days.ago
  
  # TODO: set current_user
  # Maybe something like this?
     # @user_session = UserSession.new({
     #    :remember_me =&gt; true,
     #    :password =&gt;"[FILTERED]",
     #    :email =&gt; email
     # }).save
  
  
  
    flash[:success] = "Welcome, #{@user.name}"
    redirect_to :root
  end  
  </code></pre>