So you’ve been trying a lot of trial and errors just to enable cookie based session on a API only rails app? Are you trying to customize the cookie expiration but it simply defaulting to default session only cookies? The solution is quite simply though and here it is.
config/application.rb, you set the cookie parameters upon calling the middleware.
# ... require and other codes here module AppNameHere class Application < Rails::Application config.api_only = true config.middleware.use ActionDispatch::Cookies config.middleware.use ActionDispatch::Session::CookieStore, key: '_coookie_name', expire_after: 30.days end end