Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3232684
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:11:23+00:00 2026-05-17T17:11:23+00:00

I am writing a Rails back-end API for a Steam game that is only

  • 0

I am writing a Rails back-end API for a Steam game that is only accessed via REST calls, so no user-specific authentication is required. I am trying to implement the authlogic_api plug-in for the Authlogic gem, which uses an api_key/signature mechanism to restrict access. I have implemented the ApplicationSession and ApplicationAccount models as outlined in the rdocs, but I’m not sure how to modify my ApplicationController to restrict access.

Looking at the source, it appears the authlogic_api plug-in modifies the ActsAsAuthentic and Session modules from Authlogic. But since this is essentially “single access” authentication, requiring the API key and signature to be passed on every request, I don’t see how sessions would be a factor.

Has anyone successfully implemented authlogic_api in their apps? If so, would you share your approach for setting up your ApplicationController?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T17:11:23+00:00Added an answer on May 17, 2026 at 5:11 pm

    Actually, it’s much simpler. Using all that code from the Authlogic example is somewhat overkill – it mainly manages storing session details, which you don’t need to do for the Application (also known as Client) session. The Client session is re-confirmed at every request.

    All you need is:

    models\client.rb

    class Client < ActiveRecord::Base
      acts_as_authentic do |config|
      end
    end
    

    models\client_session.rb

    class ClientSession < Authlogic::Session::Base
      api_key_param 'app_key'
    end
    

    controllers\application_controller

    before_filter :verify_client
    
    def verify_client
      @client_session = ClientSession.new()
      unless @client_session.save # if client session not successfully created using the api_key and signature, render an error and block the request
        @error = {:description => "Couldn't validate client application."}
        render :template => 'errors/error.xml.builder'
      end
    end
    

    You also need to run a migration to create the clients table. Not all of the fields below are necessary, but they won’t hurt.

    class CreateClients < ActiveRecord::Migration
      def self.up
        create_table :clients do |t|
          # human fields
          t.string :name
          t.string :owner
          t.string :owner_email
          t.string :owner_phone
          # login fields
          t.string :api_key, :null => false
          t.string :api_secret, :null => false
          t.string :password_salt
          t.string :persistence_token
          t.string :perishable_token
          # automagical fields (courtesy of authlogic & authlogic_api)
          t.integer :failed_login_count
          t.datetime :last_request_at
          t.integer :request_count
          t.string :last_request_ip
          # automagical fields (courtesy of rails)
          t.timestamps
        end
      end
    
      def self.down
        drop_table :clients
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a rails app that has a model called 'User' and a model
I'm currently writing a Rails 3 app that uses the google maps API (v3)
guys! I`m collecting info about writting a game for web using Rails back-end. Are
I'm writing a Rails app that needs to store shape data representing the floor
We are writing a Rails application that is using CouchDB as its data store.
I'm writing my first Rails app and I'm confused by a method call that
I'm writing a mountable Rails 3.1 engine that adds features to the main app
I'm writing a little Rails app & part of that is pulling in a
I'm building a web game in Ruby on Rails that relies on a choose-your-own-adventure
I am writing a Rails helper method that will add wrapper html to captured

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.