class Api::V1::AuthsController < Devise::OmniauthCallbacksController
def twitter; end
private
def callback
user = User.find_or_authenticate_by_oauth(request.env["omniauth.auth"], session['beta_signup_token'])
if session['beta_signup_token']
render json: {redirect: :complete_profile}
else
render json: {redirect: :stories}
end
end
end
namespace :api do
namespace :v1 do
devise_scope :user do
match 'auth/:provider' => 'auths#passthru', constraints: { format: :json }
match 'auth/:provider/callback', to: 'auths#callback', constraints: { format: :json }
end
end
end
Started GET "/api/v1/auth/twitter.json" for 127.0.0.1 at 2013-04-02 14:43:32 -0500
Processing by Api::V1::AuthsController#passthru as JSON
Parameters: {"provider"=>"twitter"}
Rendered text template (0.0ms)
Completed 404 Not Found in 4ms (Views: 0.5ms | ActiveRecord: 0.0ms)
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
before_filter :handle_authentication
def facebook
end
def twitter
end
def linkedin
end
private
def handle_authentication
user = User.find_or_authenticate_by_oauth(request.env["omniauth.auth"], session['beta_signup_token'])
if session['beta_signup_token']
redirect_to setup_profile_beta_invite_url(session['beta_signup_token'])
else
sign_in_and_redirect
end
end
end
devise_for :users, constraints: { format: :html },
:controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
(twitter) Callback phase initiated.
Started GET "/users/auth/twitter" for 127.0.0.1 at 2013-04-02 15:40:04 -0500
如何使第一个响应与第二个响应相同?我想在第一个,Twitter策略没有被调用,为什么?
我认为我的其他question是相关的