Welcome Developers!

in

Welcome!

in

access token request returns 401

Last post 02-03-2012 5:38 AM by Manasij Sur. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 01-13-2012 4:56 AM

    access token request returns 401

     Hi,

    Like many people on this forum, Im stuck too with the access_token retrieval state. Im getting 401 with oauth_problem=signature invalid or sometimes oauth_problem=token_rejected

    The base string for my signature is same as the one generated in the OAuth tool. My Oauth code is working fine for Twitter and LinkedIn so I dont know whats wrong with Myspace,-

    My  details are,-

    Received oauth_token in step 2 (via callback url) is,-

    C5hWFtaVQpwYUpFv3nEcmIuLxuyByRnZRVC9ty1%252BlN51%252Bj2CTltkod%252BDqTY%252BoFEH6xOSJ6tA7PSdN24VJ4xXd7tCj3yXz6ScUm8V1CRjye7ydzUSahe4fb0dO4ooTbj8

    Base string:-

    GET&http%3A%2F%2Fapi.myspace.com%2Faccess_token&oauth_consumer_key%3D2cee36c02aee41f3886b023adf682ad4%26oauth_nonce%3D665792416%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1326457502%26oauth_token%3DC5hWFtaVQpwYUpFv3nEcmIuLxuyByRnZRVC9ty1%2525252BlN51%2525252Bj2CTltkod%2525252BDqTY%2525252BoFEH6xOSJ6tA7PSdN24VJ4xXd7tCj3yXz6ScUm8V1CRjye7ydzUSahe4fb0dO4ooTbj8


    key =
    ef0692c6b2f442a9bb9944b5e07b366f8876e9014de749e0ab25652df835980f&b4313d9513f4421abefc4205e64e28a0d26e46c19f6f42f591af2c4513a3323


    Request URL:-

    http://api.myspace.com/access_token?oauth_consumer_key=2cee36c02aee41f3886b023adf682ad4&oauth_nonce=665792416&oauth_signature=0ueLzdGDiOc7jgoe/kfXXCuKMCg=&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1326457502&oauth_token=C5hWFtaVQpwYUpFv3nEcmIuLxuyByRnZRVC9ty1%25252BlN51%25252Bj2CTltkod%25252BDqTY%25252BoFEH6xOSJ6tA7PSdN24VJ4xXd7tCj3yXz6ScUm8V1CRjye7ydzUSahe4fb0dO4ooTbj8

     

    In the request URL i have added the oauth_token after url encoding for once and in the base string I have added oauth_token after double url encoding.

    Found that Oauth tool is doing the same. Also tried with no encoding in URL and single encoding for base string for which it returned signature_invalid.

    Im stuck with this for the last 3 days, please help someone :(

    Please note, Im using query based authorization (tried header based too with empty body, but got HTTP 411)

    Thanks in advance

  • 01-15-2012 10:44 PM In reply to

    Re: access token request returns 401

     Someone please reply :(

  • 01-24-2012 6:37 PM In reply to

    Re: access token request returns 401

     Is developer support dead here???

  • 01-24-2012 7:28 PM In reply to

    • Kirill
    • Not Ranked
    • Joined on 12-07-2011
    • Posts 7

    Re: access token request returns 401

     Hi!

    I have this problen on the previous step.

    Erorr was in the oauth_token param.There was the diference between Oauth Tool url (not base string and signature, it's important) and mine url, which used in curl request.

    I found on this forum some advices, that params, before signing, must be prepared like thi:

    $tmp_row = str_replace( '%2B', '%2520', $tmp_row);
    $tmp_row = str_replace( '%252', '%25252', $tmp_row);

    I try, and my problem with request_token was solved. 

    Now, i make base_string, signature etc., and after this, before creating curl url i do that:

    $config['oauth_token'] = str_replace('%2', '%252', $token_request_params['oauth_token']);
    $token = $this->providerApi->myspace_request($config);

    And it works!

    But now i have problem with notification api, and i can't find any help on this forum.

     

  • 01-25-2012 2:14 AM In reply to

    Re: access token request returns 401

      Thnx for the reply, but Im getting the same problem, this time im getting token_rejected in the last step (access token step)
     What I tried is like,-
    1) To generate base string for each param,-
     Replace %2B with %2520
     Replace again %252 with %25252
    2) for the URL,-
     Replace %2 with %252

  • 01-25-2012 3:35 AM In reply to

    • Kirill
    • Not Ranked
    • Joined on 12-07-2011
    • Posts 7

    Re: access token request returns 401

     May be some problems in curl request? Beacouse of signature errors absent. Or old token.

    But i thin the most problem, is that myspace developers team didn't reply to us =(

    Sorry my english.

  • 01-25-2012 8:43 AM In reply to

    Re: access token request returns 401

     Thnx Kirill for your help. You are right,the main probs is no once from MySpace team is replying , I am doing trial n error like anything w/o any success, someone from MDP please reply. I can send the tcpdumps to MDP if they ask me to.

  • 02-03-2012 5:38 AM In reply to

    Re: access token request returns 401

     I finaly got it working with OAuth 1.0a, for some strange reasons it dint work on 1.0 (followed every steps including all trial n err :( )

    Follow this step for myspace oauth 1.0a:- http://developer.myspace.com/community/forums/t/9450.aspx

Page 1 of 1 (8 items)