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

  • Home
  • SEARCH
  • 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 6761447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:11:32+00:00 2026-05-26T14:11:32+00:00

I am using Devise with Rails 3.0.6 and ExtJS 4.0.6 . Devise Session ends

  • 0

I am using Devise with Rails 3.0.6 and ExtJS 4.0.6.
Devise Session ends after every AJAX Request from ExtJs.

I have gone through the links given here and here, but no luck.
What could be the possible workaround for the same?

P.S: Code given here is already present within rails.js in rails 3.0.6.

  • 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-26T14:11:32+00:00Added an answer on May 26, 2026 at 2:11 pm

    What I have done in the past is to authenticate using HTTP authentication headers.

    Here are some rough steps to follow:

    In config/initializers/devise.rb, set the http_authenticatable config option to true.

    config.http_authenticatable = true
    

    Then in your ExtJS login panel, your form submission would look something like this:

    var values = form.getValues();
    var encodedCredentialsFromFormFields = Base64.encode(values['username'] + ':' + values['password']);
    
    form.submit({
      url: '/users/sign_in',
      headers: {
        'Accept': 'application/json',
        'Authorization': 'Basic ' + encodedCredentialsFromFormFields
      },
      failure: function(form, action) {
        if (action.response.status === 401) { // Unauthorized
          console.log('sign in unsuccessful');
        } else if (action.response.status === 201) { // Created (as in new session created by Devise)
          console.log('sign in successful');
          if (! Ext.Ajax.defaultHeaders) {
            Ext.Ajax.defaultHeaders = {}
          }
          Ext.Ajax.defaultHeaders['Authorization'] = 'Basic ' + encodedCredentialsFromFormFields;
        } else {
          console.log('failed with status: ' + action.response.status);
        }
      }
    });
    

    The encodedCredentialsFromFormFields variable is a Base64 encoded string of the form “username:password”. Note the colon (:) between the username and password. I’ve found the Base64 library from http://www.webtoolkit.info/javascript-base64.html to work well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Devise in a Rails application, and I can set session data through
I'm using Devise as authenticating solution in Rails and I have a cached fragment
Hi I am using devise for my auth system in rails. I have 2
I have a rails application, and I authenticate users to the application using Devise.
I am using Devise with Ruby on Rails. I have a few pages that
I am using Devise in Rails 3, and have a User model in rails
I have a Rails 3 App using devise. I want to create a User/Profile
I am using devise in my rails application and I have two different resource
I have a Rails 3 application using Devise for authentication. In addition to the
I have a Rails 3 App using Devise on Heroku. Problem is I'm sending

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.