経緯
Rails初心者です。
以下の記事を参考に
https://qiita.com/cigalecigales/items/f4274088f20832252374
deviseとomniauthを使用してTwitterログインを実装しようとしたのですが、
なぜか
『Sign in With Twitter』クリック
→『連携アプリを認証』クリック
→Sign Up画面へ
という流れになってしまいます。
(本来は『連携アプリを認証』したらユーザー画面に飛ぶかと思います。。。)
bundle installによって大量のファイルができてしまっているため、どのファイルをいじればいいかも分からずじまいで困っています。
どなたか分かる方いらっしゃいましたらお力添えいただければ幸いです。
コード
参考になるかは分かりませんが、Sign in With Twitterのリンク先は/users/auth/twitterです。
routes.rb Rails.application.routes.draw do devise_for :users, controllers: { :omniauth_callbacks => "omniauth_callbacks" } root 'pages#index' get 'pages/show' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end
omniauth_callbacks_controller.rb def twitter @user = User.from_omniauth(request.env["omniauth.auth"].except("extra")) if @user.persisted? sign_in_and_redirect @user else session["devise.user_attributes"] = @user.attributes redirect_to new_user_registration_url end end
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。