omn​​iauth facebook可以从子域登录吗

can omniauth facebook be sign in from sub domain

当我想允许用户从子域登录时,我遇到了一个问题。我已经使用 "lvh.me:3000" 创建了 FB 应用程序,当我从那个 url 登录时发现了这个工作。但是,当我想允许用户从子域 Ex "abc.lvh.me:3000" 登录时,出现了一个我无法登录的错误。我对 google 进行了研究,我找到了一个这样的解决方案: ruby <%= link_to "Sign with FB", user_omniauth_authorize_url(:facebook, subdomain: false), class: "btn btn-facebook" %> 并且它可以找到但在登录后它没有重定向到 "abc.lvh.me:3000" 而是重定向到 "lvh.mr:3000" 。那么你知道我该如何解决这个问题吗?

您可以使用设计after_sign_in_path_for

重定向回来
class ApplicationController < ActionController::Base
  def after_sign_in_path_for(resource)
   # check here that request is come from sub domain 
   # if come from sub domain then redirect it otherwise redirect your root path
  end
end