Welcome Developers!

in

Welcome!

in

STATE USER AND AUTHENTICATION

Last post 09-24-2012 1:00 PM by intropedro. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 02-07-2010 9:16 AM

    • Noelia
    • Not Ranked
    • Joined on 11-10-2009
    • Posts 3

    STATE USER AND AUTHENTICATION

    Hello.

    I'm trying to get the status of a user for which you have to make an HTTP request. I have read that I have two ways to do this:

                    - The base uri to do is: http://api.myspace.com/v1/users/ (userId) / status

                    - Or with the opensocial: http://opensocial.myspace.com/roa/09/statusmood.

    My application would be a external application and want to know which of these two methods should I do it.

    You've seen in the section of tools that I need to form the HTTP header for authentication with OATH and I've searched a lot of information and still do not know how to do well .... really need help. I created an application and have received a token for that oath external application and nothing more, apart from the consumer key and secret ...

     THANK YOU

  • 02-08-2010 5:03 PM In reply to

    Re: STATE USER AND AUTHENTICATION

     As long as you're able to get a request token you will be able to make these calls. Please see the Oauth flow instructions here. I'd recommend using the Opensocial 0.9 APIs for GETing user status.

     Oauth 1.0 and 1.0A Steps - Making Proper API Calls:

    Oauth 1.0
    1.      http://api.myspace.com/request_token?{oauth-signed-parameters} <http://api.myspace.com/request_token?%7boauth-signed-parameters%7d>  

    (signed oauth request, returns request_token and the secret in the body)

    2.      http://api.myspace.com/authorize?oauth_token={your-request-token}&oauth_callback={your-callback-url} <http://api.myspace.com/authorize?oauth_token=%7byour-request-token%7d_callback=%7byour-callback-url%7d <http://api.myspace.com/authorize?oauth_token=%7byour-request-token%7d&oauth_callback=%7byour-callback-url%7d> >

     (on success authorizes the request_token so you can get an access_token and redirect you to callback)

    3.      http://api.myspace.com/access_token?oauth_token={your-request-token}&{oauth-signed-parameters} <http://api.myspace.com/access_token?oauth_token=%7byour-request-token%7d%7boauth-signed-parameters%7d <http://api.myspace.com/access_token?oauth_token=%7byour-request-token%7d&%7boauth-signed-parameters%7d> >

    (signed oauth request, returns access_token and the secret in response body)

    4.      store the access_token and secret associated and use it to make other api calls


    Oauth 1.0A
    1.       http://api.myspace.com/request_token?oauth_callback={your-callback-uri}&{more-oauth-signed-parameters} <http://api.myspace.com/request_token?oauth_callback=%7byour-callback-uri%7d%7bmore-oauth-signed-parameters%7d <http://api.myspace.com/request_token?oauth_callback=%7byour-callback-uri%7d&%7bmore-oauth-signed-parameters%7d> >

     

    (signed oauth request, returns ex.  oauth_token=ADiOqxLWJmtUH2vX6lB%EvqTseiJPPOp&oauth_token_secret=48ec4365fd62475b88ebaac47ba14&oauth_callback_confirmed=true)

    (notice the additional parameter called oauth_callback_confirmed, this means it's 1.0A)

    2.      http://api.myspace.com/authorize?oauth_token={your-request-token} <http://api.myspace.com/authorize?oauth_token=%7byour-request-token%7d_callback=%7byour-callback-url%7d <http://api.myspace.com/authorize?oauth_token=%7byour-request-token%7d&oauth_callback=%7byour-callback-url%7d> >

    (notice that there is no oauth_callback passed into this one)

    (an additional parameter is returned on the callback redirect oauth_verifier=961d535d-d6ab-4507-91e8-35c79b8c6691)

    3.      http://api.myspace.com/access_token?oauth_token={your-request-token}&oauth_verifier={oauth-verifier-from-authorize}&{oauth-signed-parameters} <http://api.myspace.com/access_token?oauth_token=%7byour-request-token%7d_verifier=%7boauth-verifier-from-authorize%7d%7boauth-signed-parameters%7d <http://api.myspace.com/access_token?oauth_token=%7byour-request-token%7d&oauth_verifier=%7boauth-verifier-from-authorize%7d&%7boauth-signed-parameters%7d> >

    (signed oauth request, returns access_token and the secret in response body)


    Properly encoding your requests:

    The base string needs to be percent encoded as below (that's a DIFFERENT scheme than url encoded!):

    Base string
    GET&http://api.myspace.com/access_token= <http://api.myspace.com/access_token&oauth_token=> {your-token}

    GET is percent encoded and http://api.myspace.com/access_token is also percent encoded.

    Each parameter in the base is percent encoded and then the whole thing is percent encoded, like so:

    PercentEncode(PercentEncode(oauth_token)=PercentEncode({your-token}&other-parameters-done-the-same))

    Percent encoding is defined in rfc3986:

    http://tools.ietf.org/html/rfc3986
    http://labs.apache.org/webarch/uri/rfc/rfc3986.html#percent-encoding

    A percent-encoding mechanism is used to represent a data octet in a component when that octet's corresponding character is outside the allowed set or is being used as a delimiter of, or within, the component. A percent-encoded octet is encoded as a character triplet, consisting of the percent character "%" followed by the two hexadecimal digits representing that octet's numeric value. For example, "%20" is the percent-encoding for the binary octet "00100000" (ABNF: %x20), which in US-ASCII corresponds to the space character (SP). Section 2.4 describes when percent-encoding and decoding is applied.
    pct-encoded = "%" HEXDIG HEXDIG
    The uppercase hexadecimal digits 'A' through 'F' are equivalent to the lowercase digits 'a' through 'f', respectively. If two URIs differ only in the case of hexadecimal digits used in percent-encoded octets, they are equivalent. For consistency, URI producers and normalizers should use uppercase hexadecimal digits for all percent-encodings.

    Also, be sure to exclude the status parameter from the base string used to generate your signature, and put it in the post body.

    POSTing addendum: when you POST, you need to make sure the Content-Length header matches the size of the content in the body. Also, we attempt to read the OAuth parameters from the body content if the HTTP method is POST/PUT and the ContentType is application/x-www-form-urlencoded.  If that is the case, we try to read the OAuth params from the key/value pairs.

    Additionally, if you want a more thorough overview of the entirety of Oauth, please see the docs here: http://tools.ietf.org/html/draft-hammer-oauth-08

     

     

    thanks,

    Joel

     

  • 07-16-2010 12:52 AM In reply to

    Re: STATE USER AND AUTHENTICATION

    Is it possible for someone to post a working PHP example?

  • 07-16-2010 2:43 PM In reply to

    Re: STATE USER AND AUTHENTICATION

     I don't have such an example but we are working on an updated SDK for this, with better docs. What is currently tripping you up? Are you able to get a request_token yet?

     

    thanks,

    Joel

  • 07-19-2010 9:14 AM In reply to

    • Fakey
    • Not Ranked
    • Joined on 07-14-2010
    • Posts 5

    Re: STATE USER AND AUTHENTICATION

    To get the request token , uou wrote: http://api.myspace.com/request_token?{oauth-signed-parameters} But what do we need to put in for 'oauth-signed-parameters'? Where do we get these parameters?
  • 07-19-2010 2:05 PM In reply to

    Re: STATE USER AND AUTHENTICATION

     Here is another resource you can examine. Look at the example here. These are the values you need to pass in to create your oauth signature from:

    http://oauth.net/core/1.0/#anchor27

     

    this is it, for others viewing this thread:

    https://photos.example.net/request_token?oauth_consumer_key=dpf43f3p2l4k3l03&oauth_signature_method=HMAC-SHA1
    &oauth_signature=kd94hf93k423kf44%26&oauth_timestamp=1191242090&oauth_nonce=hsu94j3884jdopsl&oauth_version=1.0

     Note we only support HMAC-SHA1 as our signature method.

     

  • 09-24-2012 1:00 PM In reply to

    Re: STATE USER AND AUTHENTICATION

    Are these urls still work?

    http://api.myspace.com/request_token
    http://api.myspace.com/authorize
    http://api.myspace.com/access_token

    Filed under:
Page 1 of 1 (7 items)