Rails.root: /Users/kurashikiyuuki/アプリ/card_list_share_app
actionpack (7.0.8.4) lib/action_controller/metal/request_forgery_protection.rb:253:in `handle_unverified_request'
actionpack (7.0.8.4) lib/action_controller/metal/request_forgery_protection.rb:286:in `handle_unverified_request'
devise (4.9.4) lib/devise/controllers/helpers.rb:257:in `handle_unverified_request'
actionpack (7.0.8.4) lib/action_controller/metal/request_forgery_protection.rb:275:in `verify_authenticity_token'
activesupport (7.0.8.4) lib/active_support/callbacks.rb:400:in `block in make_lambda'
activesupport (7.0.8.4) lib/active_support/callbacks.rb:199:in `block (2 levels) in halting'
actionpack (7.0.8.4) lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
activesupport (7.0.8.4) lib/active_support/callbacks.rb:200:in `block in halting'
activesupport (7.0.8.4) lib/active_support/callbacks.rb:595:in `block in invoke_before'
activesupport (7.0.8.4) lib/active_support/callbacks.rb:595:in `each'
activesupport (7.0.8.4) lib/active_support/callbacks.rb:595:in `invoke_before'
activesupport (7.0.8.4) lib/active_support/callbacks.rb:116:in `block in run_callbacks'
turbo-rails (2.0.6) lib/turbo-rails.rb:24:in `with_request_id'
turbo-rails (2.0.6) app/controllers/concerns/turbo/request_id_tracking.rb:10:in `turbo_tracking_request_id'
activesupport (7.0.8.4) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
actiontext (7.0.8.4) lib/action_text/rendering.rb:20:in `with_renderer'
actiontext (7.0.8.4) lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'
activesupport (7.0.8.4) lib/active_support/callbacks.rb:127:in `instance_exec'
activesupport (7.0.8.4) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
activesupport (7.0.8.4) lib/active_support/callbacks.rb:138:in `run_callbacks'
actionpack (7.0.8.4) lib/abstract_controller/callbacks.rb:233:in `process_action'
actionpack (7.0.8.4) lib/action_controller/metal/rescue.rb:23:in `process_action'
actionpack (7.0.8.4) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
activesupport (7.0.8.4) lib/active_support/notifications.rb:206:in `block in instrument'
activesupport (7.0.8.4) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (7.0.8.4) lib/active_support/notifications.rb:206:in `instrument'
actionpack (7.0.8.4) lib/action_controller/metal/instrumentation.rb:66:in `process_action'
actionpack (7.0.8.4) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
activerecord (7.0.8.4) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (7.0.8.4) lib/abstract_controller/base.rb:151:in `process'
actionview (7.0.8.4) lib/action_view/rendering.rb:39:in `process'
actionpack (7.0.8.4) lib/action_controller/metal.rb:188:in `dispatch'
actionpack (7.0.8.4) lib/action_controller/metal.rb:251:in `dispatch'
actionpack (7.0.8.4) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (7.0.8.4) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (7.0.8.4) lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
actionpack (7.0.8.4) lib/action_dispatch/routing/mapper.rb:48:in `serve'
actionpack (7.0.8.4) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.8.4) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (7.0.8.4) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.0.8.4) lib/action_dispatch/routing/route_set.rb:852:in `call'
omniauth (2.1.2) lib/omniauth/strategy.rb:202:in `call!'
omniauth (2.1.2) lib/omniauth/strategy.rb:169:in `call'
omniauth (2.1.2) lib/omniauth/strategy.rb:202:in `call!'
omniauth (2.1.2) lib/omniauth/strategy.rb:169:in `call'
omniauth (2.1.2) lib/omniauth/builder.rb:44:in `call'
omniauth (2.1.2) lib/omniauth/strategy.rb:202:in `call!'
omniauth (2.1.2) lib/omniauth/strategy.rb:169:in `call'
omniauth (2.1.2) lib/omniauth/builder.rb:44:in `call'
warden (1.2.9) lib/warden/manager.rb:36:in `block in call'
warden (1.2.9) lib/warden/manager.rb:34:in `catch'
warden (1.2.9) lib/warden/manager.rb:34:in `call'
rack (2.2.9) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.9) lib/rack/etag.rb:27:in `call'
rack (2.2.9) lib/rack/conditional_get.rb:40:in `call'
rack (2.2.9) lib/rack/head.rb:12:in `call'
actionpack (7.0.8.4) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
actionpack (7.0.8.4) lib/action_dispatch/http/content_security_policy.rb:36:in `call'
rack (2.2.9) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.9) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/cookies.rb:704:in `call'
activerecord (7.0.8.4) lib/active_record/migration.rb:638:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (7.0.8.4) lib/active_support/callbacks.rb:99:in `run_callbacks'
actionpack (7.0.8.4) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
web-console (4.2.1) lib/web_console/middleware.rb:132:in `call_app'
web-console (4.2.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (4.2.1) lib/web_console/middleware.rb:17:in `catch'
web-console (4.2.1) lib/web_console/middleware.rb:17:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/show_exceptions.rb:29:in `call'
railties (7.0.8.4) lib/rails/rack/logger.rb:40:in `call_app'
railties (7.0.8.4) lib/rails/rack/logger.rb:25:in `block in call'
activesupport (7.0.8.4) lib/active_support/tagged_logging.rb:99:in `block in tagged'
activesupport (7.0.8.4) lib/active_support/tagged_logging.rb:37:in `tagged'
activesupport (7.0.8.4) lib/active_support/tagged_logging.rb:99:in `tagged'
railties (7.0.8.4) lib/rails/rack/logger.rb:25:in `call'
sprockets-rails (3.5.2) lib/sprockets/rails/quiet_assets.rb:17:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
request_store (1.7.0) lib/request_store/middleware.rb:19:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/request_id.rb:26:in `call'
rack (2.2.9) lib/rack/method_override.rb:24:in `call'
rack (2.2.9) lib/rack/runtime.rb:22:in `call'
activesupport (7.0.8.4) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/server_timing.rb:61:in `block in call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/server_timing.rb:26:in `collect_events'
actionpack (7.0.8.4) lib/action_dispatch/middleware/server_timing.rb:60:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/static.rb:23:in `call'
rack (2.2.9) lib/rack/sendfile.rb:110:in `call'
actionpack (7.0.8.4) lib/action_dispatch/middleware/host_authorization.rb:138:in `call'
railties (7.0.8.4) lib/rails/engine.rb:530:in `call'
puma (5.6.8) lib/puma/configuration.rb:252:in `call'
puma (5.6.8) lib/puma/request.rb:77:in `block in handle_request'
puma (5.6.8) lib/puma/thread_pool.rb:340:in `with_force_shutdown'
puma (5.6.8) lib/puma/request.rb:76:in `handle_request'
puma (5.6.8) lib/puma/server.rb:443:in `process_client'
puma (5.6.8) lib/puma/thread_pool.rb:147:in `block in spawn_thread'
Request
Parameters:
{"authenticity_token"=>"[FILTERED]", "user"=>{"email"=>"sample@sample.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Log in"}
Response
Headers:
None
実現したいこと LINEログイン機能を実装している
実現するために自分が選んだ手段とその理由 Deviseを利用してLINEログイン機能を実装は簡単と聞いて
3.その手段を使って実装するために参考にした公式ドキュメントや技術記事 https://qiita.com/s10aim_tana/items/2d174d4e31e4041700ee
4.参考にしたものと自分の実装で違う箇所・もしくは違う箇所はなくまったく同じ実装方法をしている(どういう実装をすれば実現できるのかを理解しているのかどうか)
↓
名前のカラムはfirst_nameとlast_nameにしていたのですがLINEログインのために統合してnameになるようにマイグレーションファイルを追加しました
devise.rb
↓
provider_ignores_state: Rails.env.development? 開発環境ではCSRFトークンの検証を無視する設定を入れました
↓
expire_after: 14.days, secure: true認証コードの期限を伸ばすためにしました
5.エラーが出ているのかエラーが出ていないのか、エラーが出ているのであればどんなエラーが出ているのか
invalid_grant: OAuth2認証プロトコルにおけるこのエラーは、LINEから返された認証コードが有効でない、または期限切れであることを示しています。これは、LINEログインの認証フローの一部である「認可コード」をアクセストークンに交換する際に発生します。
6.そのエラーの内容から推測したエラーの原因 stateが保存されていないので期限が切れていると思いました
7.エラーの原因を解決するために自分で調べた記事 https://github.com/omniauth/omniauth-oauth2/issues/58 https://qiita.com/norifumi-y@github/items/bdacacb5eae158ff6f2e
8.調べた記事を元に自分で行った対処法とその結果 session_storeの期限を伸ばした https化ができているのではないかと考え、ngrokの無料プランで設定を追加した
対処を行った際にわかったことや推測できたこと httpsは関係ないこと session_storeの期間が関係ないこと
この画像の画面まではいけるのですが、ログインを押すと先程のエラーのログが出てログイン画面に戻ってしまう LINEアカウントにはログインをしましたと通知が来ています