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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:51:15+00:00 2026-06-09T09:51:15+00:00

I am trying to authenticate user using OAuth and retrieve the user data. When

  • 0

I am trying to authenticate user using OAuth and retrieve the user data. When the user is not signed into twitter the authentication works and I am able to get the user details. But if the user is already signed in on twitter I am getting this error message ‘403 Forbidden: The server understood the request, but is refusing to fulfill it.’ . In some posts they said to make all the requests through https instead of http. That I have done. I have downloaded the code for authentication from ‘http://net.tutsplus.com/tutorials/php/how-to-authenticate-users-with-twitter-oauth/’ . Please help.

$twitterOauthObj    =   new TwitterOAuth($oauth_consumer_key, $oauth_consumer_secret);
if(!isset($_GET['oauth_token'])){

    $requestTokenArray  =   $twitterOauthObj->getRequestToken($callback_url);
    $requestToken       =   $requestTokenArray['oauth_token'];
    $tokenSecret        =   $requestTokenArray['oauth_token_secret'];

    $authorizeUrl       =   $twitterOauthObj->getAuthorizeURL($requestToken);
    $response       =   $twitterOauthObj->oAuthRequest($authorizeUrl, 'GET', $requestTokenArray);
    print_r($response);
} else{

    $oauthToken     =   $_GET['oauth_token'];
    $requestToken       =   $oauthToken;
    $oauthVerifier      =   $_GET['oauth_verifier'];
    $accessTokenArray   =   $twitterOauthObj->getAccessToken($oauthVerifier, $oauthToken);
        $oauthToken     =   $accessTokenArray['oauth_token'];
    $oauthTokenSecret   =   $accessTokenArray['oauth_token_secret'];
    $userTwitterId      =   $accessTokenArray['user_id'];
    $screenName     =   $accessTokenArray['screen_name'];
 }
  • 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-09T09:51:17+00:00Added an answer on June 9, 2026 at 9:51 am

    Ok. I got it working. I was not redirecting to authorize url correctly. Here is the modified code.

    if(!isset($_GET['oauth_token'])){
    
        $requestToken   =   $twitterOauthObj->getRequestToken();
        $_SESSION["oauth_token"] = $requestToken["oauth_token"];
        $_SESSION["oauth_token_secret"] = $requestToken["oauth_token_secret"];
    
        header("Location:".$twitterOauthObj->getAuthorizeURL($requestToken["oauth_token"]));
    
    }
    

    Thank you guys for all your valuable suggestions. Really appreciate it!!

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

Sidebar

Related Questions

I'm trying to get the Oauth authenticated user's profile information using Twitterizer. I believe
I've been able to finally get python-openid to authenticate a user, but I'm not
I'm using the Facebook C# SDK and trying to authenticate my user. The first
I trying authenticate user in Spring Security application via oAuth. I'm already received token
I'm trying to authenticate a user through the RESTful API (not Connect) but I
I'm trying to authenticate a user against Active Directory using the types in the
I do not know much about encrypting. I am trying to use authenticate user
I'm trying to get some basic authentication/authorization with devise/cancan with Rails. Rather than using
I 'm trying to implement user authentication and authorization using roles table, user table
I was trying to authenticate a user using EB's loginWidget example, and as I

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.