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 7859821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:02:53+00:00 2026-06-02T22:02:53+00:00

I am using the devise, omniauth, omniauth-twitter and twitter gems in a rails 3

  • 0

I am using the devise, omniauth, omniauth-twitter and twitter gems in a rails 3 app. I want to make it so when a user signs out it also removes the twitter gem configuration. What I’m referring to when I say “twitter gem configuration” is this:

Twitter.configure do |config|
  config.consumer_key = YOUR_CONSUMER_KEY
  config.consumer_secret = YOUR_CONSUMER_SECRET
  config.oauth_token = YOUR_OAUTH_TOKEN
  config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
end

If I don’t do that and another user logs onto the app from the same computer but doesn’t have a user account, they will see the previous user’s twitter information. I believe I can remove the configuration by calling

Twitter.reset

I guess my question is where would be the best place to put that? Also if that isn’t the best way to remove the user’s twitter configuration, how should I do it?

Thanks and let me know if you need any more details.

  • 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-06-02T22:02:54+00:00Added an answer on June 2, 2026 at 10:02 pm

    This seems to be working.

    In /app/controllers/application_controller.rb you can redirect the default route devise sends the user when they sign_in/out. I’m not sure if this is the “proper” place to put this but it seems reasonable.

    class ApplicationController < ActionController::Base
      protect_from_forgery
    
      def after_sign_in_path_for(resource_or_scope)
        if current_user.authentications.find_by_provider("twitter")
          ckey= YOUR_APPS_CONSUMER_KEY
          csecret= YOUR_APPS_CONSUMER_SECRET
          auth = current_user.authentications.find_by_provider("twitter")
          atoken = auth.token
          asecret = auth.secret
          Twitter.configure do |config|
            config.consumer_key = ckey
            config.consumer_secret = csecret
            config.oauth_token = atoken
            config.oauth_token_secret = asecret
          end
        end
    
        authentications_path
      end
    
      def after_sign_out_path_for(resource_or_scope)
          Twitter.reset
          authentications_path
      end
    
    
    end
    

    The authentications_path is just the page I’m using to test the authentications and related things. You can redirect anywhere. When a user links an account I save their oauth token and secret in the authentication object. You will need this to access certain aspects of the Twitter gem.

    I’ll wait a little while to mark this as the answer, see if someone has a better solution.

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

Sidebar

Related Questions

We have a web app running on Rails, using Devise and OmniAuth for user
So I am using Devise for user authentication in my rails app. I have
I am using Devise and omniauth for authentication in my rails app. I have
I'm using DEvise for registration and omniauth for authentication through twitter/facebook, I want to
I'm using Devise & Omniauth on my rails 3.0.7 app, and I've already set
I'm using Devise and OmniAuth (Facebook) in a Rails 3 app. I just started
I am using devise omniauth in my rails application, here is the User class
I'm using omniauth-facebook gem with rails 3.2 and devise 2.0. I have a website
I am using Devise gem and I want to change the redirect path after
I have a class User in Rails using Mongoid and Devise. I can't seem

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.