当用户使用 rails 设计的社交媒体帐户登录时,如何显示 omniauth linkedin flash 消息

how to show the omniauth linkedin flash message when user signin with social media account with rails devise

devise.en.yml

 omniauth_callbacks:
    failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
    success: "Successfully authenticated from %{kind} account."

当我使用社交媒体帐户登录时,它会return同样的成功消息。

请给我任何解决方案。谢谢

您将无法在此处直接使用 flash[:notice]。这里应该使用设备的 set_flash_message 并且你需要像这样传递 omniauth provider 的名称:

set_flash_message(:notice, :success, kind: "#{provider}".capitalize)