ぼざクリ タグ広場 https://hub.nizika.monster
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

17 lines
462 B

  1. class ApplicationController < ActionController::API
  2. before_action :authenticate_user
  3. def current_user
  4. @current_user
  5. end
  6. private
  7. def authenticate_user
  8. code = request.headers['X-Transfer-Code'] || request.headers['HTTP_X_TRANSFER_CODE']
  9. @current_user = User.find_by inheritance_code: code
  10. Rails.logger.info("X-Transfer-Code: #{request.headers['X-Transfer-Code']}")
  11. Rails.logger.info("current_user: #{@current_user&.id}")
  12. end
  13. end