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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:55:45+00:00 2026-06-02T10:55:45+00:00

Having some problems trying to exchange my JSAPI tokens for REST Oauth Tokens (

  • 0

Having some problems trying to exchange my JSAPI tokens for REST Oauth Tokens (https://developer.linkedin.com/documents/exchange-jsapi-tokens-rest-api-oauth-tokens)

I’m using this library – http://code.google.com/p/oauth-php/ – As opposed to the PECL extension as I’m unable to install extensions onto the server.

There seem to be plenty of similar questions, but none which actually answer the question – How to use the above library to authenticate with Linkedin.

My code is as follows:

    $cookie_name        = "linkedin_oauth_" . $this->_c->linkedin_api_key;
    $credentials_json   = stripslashes($_COOKIE[$cookie_name]);
    $credentials        = json_decode($credentials_json);

    // Get the Access Token + Secret
    $access_token_url = 'https://api.linkedin.com/uas/oauth/accessToken';

    OAuthStore::instance("2Leg", array(
        'consumer_key'      => $this->_c->linkedin_api_key,
        'consumer_secret'   => $this->_c->linkedin_api_secret
    ));

    try {

        $request = new OAuthRequester($access_token_url, 'POST', array(
            'xoauth_oauth2_access_token' => $credentials->access_token
        ));

        $result = $request->doRequest();

    } catch(OAuthException2 $e) {

        print_r($e->getMessage());

    }

The catch statement outputs:

Request failed with code 400: oauth_problem=parameter_absent&oauth_parameters_absent=oauth_verifier

How do I get this oauth_verifier? It was my understanding that I shouldn’t need it if I was passing the xoauth_oauth2_access_token already?

I’ve checked all of the variables I.E. $credentials and $this->_c and all of the variables are passing through correctly.

  • 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-02T10:55:50+00:00Added an answer on June 2, 2026 at 10:55 am

    This is actually a bug in the oauth-php library. The library is incorrectly handling parameters which are prefixed with xoauth_* and treating them the same way it handles oauth_* parameters. This is in violation of the OAuth spec and most (all?) other OAuth libraries don’t have this issue. The fix is to do the following:

    Inside the file OAuthRequestSigner.php, find the following:

    1) inside the getAuthorizationHeader function, find the line which reads:

    if (strncmp($name, 'oauth_', 6) == 0 || strncmp($name, 'xoauth_', 7) == 0)
    

    and change it to be:

    if (strncmp($name, 'oauth_', 6) == 0)
    

    2) Inside the function getQueryString, find the line which reads:

    ||  (strncmp($name, 'oauth_', 6) != 0 && strncmp($name, 'xoauth_', 7) != 0))
    

    and change it to be:

    ||  (strncmp($name, 'oauth_', 6) != 0)
    

    After that, all you need to do is essentially the same as you were already doing, which is the following:

    try {
    
        $request = new OAuthRequester($access_token_url, "POST", array('xoauth_oauth2_access_token' => $access_token));
    
        $result = $request->doRequest();
    
        var_dump($result);
    
    } catch(OAuthException2 $e) {
    
        print_r($e->getMessage());
    
    }
    

    And you should be all set. If you have any further issues, please do not hesitate to reach out on our developer forums and either myself or someone else on the team would be happy to help.

    Enjoy!

    -Jeremy

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

Sidebar

Related Questions

I'm having some problems trying to dynamically create multiple RadDocks at the same time.
I have been having some problems trying to get my PHP running. When I
I'm having some problems trying to get the code below to output the data
I'm having some problems trying to perform a query. I have two tables, one
I'm trying to build firefox but I'm having some problems. I currently have Visual
I'm trying to do some browser automation, but I'm having some problems. Basically, what
I'm trying build an App Engine connected Android application and am having some problems
I'm trying to export my GridView to excel, but I'm having some problems. At
I'm having some minor problems with some animations I'm trying to set up. I
I'm having some problems trying to format an If/Then condition in a Wordpress widget.

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.