开发者

Devise + OmniAuth - How to capture a FB Connect on registration

开发者 https://www.devze.com 2023-03-20 01:58 出处:网络
I\'m building a registration flow that allows a user to FB Connect to pre-populate the registration form. I\'m also then capturing fb_uuid and fb_access_token.

I'm building a registration flow that allows a user to FB Connect to pre-populate the registration form. I'm also then capturing fb_uuid and fb_access_token.

When the user submits the registration form that is submitted as follows:

Started POST "/users" for 127.0.0.1 at Mon Jul 11 17:44:40 -0700 2011
  Processing by Devise::RegistrationsController#create as HTML
  Parameters: {"commit"=>"Create my account", "fb_access_token"=>"XXXXXXXXXXX", "authenticity_token"=>"XXXXXXXXXX", "utf8"=>"✓", "user"=>{"remember_me"=>"0", "lname"=>"NNNNNN", "fname"=>"BBBBBB", "password"=>"[FILTERED]", "email"=>"dadad@google.com"}, "fb_uuid"=>"50123190"}

noti开发者_JAVA百科ce the fb_access_token, fb_uuid

In the Registration#Create, how can I capture those values and populate the Authentications table? Do I have to override devise?

Thansk


Although you may not need this right now, here's a blog post that you can use to solver your problem:

Devise on rails: Prepopulating form data

You can use the method described there to capture and process the data you need.

Hope it helps.


You can use the koala gem to pull those fb parameters from the facebook cookie after the user does a FB_Connect. Take a look at this: https://github.com/arsduo/koala/wiki/Koala-on-Rails

I'm curious on why you aren't creating the user right after the FB_Connect which is the more common and intuitive user experience, as opposed to just prepoulating the registration form. Like this: https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview

0

精彩评论

暂无评论...
验证码 换一张
取 消