Session in Rails_API gem

Hi Rails Guru, Currently I am working i my project, and that project using rails_api gem. I want to add session management for authentication, but it seems the session does not working. Here is my configuration in config/initializer/session_store.rb:

Pmcapi::Application.config.session_store :cookie_store, {

key: '_pmcapi_session', expire_after: 1.hour


And I add config.api_only = false in application.rb (

and in my session_controller, I adding session to store token

(in session_controller.rb)

  def create
#just to generate new token
session[:token] ||= user.sso_token
self.current_user = user
redirect_to root_path

when i am in application_controller, i want to access session[:token] but the result is nil (in application_controller.rb)

  def authenticate_user!
#puts("User Authentication")
@user = User.authenticate_with_token(session[:token])
#head :unauthorized unless @user.present?
redirect_to sign_in_path if @user.nil?
Please, i need help. I have stucked with this, thanks