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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:06:21+00:00 2026-05-27T18:06:21+00:00

I got access for the user using twitter_auth gem. Here is the code for

  • 0

I got access for the user using twitter_auth gem. Here is the code for that.

def twitter
  client = TwitterOAuth::Client.new(
  :consumer_key => '******',
  :consumer_secret => '********'
 )
 request_token = client.request_token(:oauth_callback => new_user_url)
 session[:request_token] = request_token
 redirect_to request_token.authorize_url
end


def new
   client = TwitterOAuth::Client.new(
      :consumer_key => '*****',
      :consumer_secret => '******'
      )
      access_token = client.authorize(
      session[:request_token].token,
      session[:request_token].secret,
      :oauth_verifier => params[:oauth_verifier]
      )
   #For testing purpose, i tried posting a status and its working perfectly fine

 client.update('I am authorized')
end

I am confused in using twitter gem cause every example from the docs says:

     Twitter.user("sferik").location // throws an error, Twitter::Error::Unauthorized: Invalid / expired Token

From friends and followers

    Twitter.accept("sferik") // throws an error, Twitter::Error::Unauthorized: Invalid / expired Token
    Twitter.follow("sferik") // throws an error, Twitter::Error::Unauthorized: Invalid / expired Token

All these errors makes sense, cause we are applying these methods on Class not an object. But how to create an object for this. I have a authorized user but how to take actions on his profile using token we got.

  • 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-27T18:06:21+00:00Added an answer on May 27, 2026 at 6:06 pm

    Use client instead of Twitter.

    You can see here how you should do it.

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

Sidebar

Related Questions

I got error Access Violation when the following code is execute : void NoAction()
I've got an MS-Access app (1/10th MS-Acccess, 9/10ths MS-SQL) that needs to display photographs
I've got an ms-access application that's accessing and ms-sql db through an ODBC connection.
I've got an Apache server that has one access log file that is topping
I've got some images in my chrome extension that I want the user to
Basically I got 2 question here: once the user given permission to a facebook
We've got a Rails application just upgraded to Rails3 using Devise's Rails3 gem for
I got a requirement from client that he wants to know distinct users information
I've got a user modification page, that displays a list of reports a user
I've got a small problem, I've denied access to my page but user is

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.