Results 1 to 9 of 9

Thread: Mediafire API help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2012
    Posts
    67

    Mediafire API help

    I'm trying to use mediafire's new REST API, but I can't get the signature for the session_key right.

    Here's their wiki: http://developers.mediafire.com/index.php/REST_API

    According to them, this format should work:
    Code:
    email + password + application_id + API Key
    But it doesn't. So I tried removing the spaces between the pluses, didn't work. Also tried removing the pluses too, didn't work. Anyone that's familiar with hashing stuff like this that maybe know what they mean?

    EDIT: yeah I also asked their support about it, the first answer I got was to check their wiki (even though I wrote that the format on their wiki didn't work). The second answer I got was the format, copied from the wiki, with no example nor any clarification. Now I am waiting for the third answer....

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Mediafire API help

    I'd suspect that they are telling you to concatenate those 4 strings (UTF-8 encoded) together, then calculate the SHA1 hash, then convert that to hex digits. Those "+" signs are probably concatentation because these kinds of people tend to be very JavaScript-centric in their thinking.

    They don't mention hex but they don't mention base64 either. The worthless "examples" just show a string of decimal digits and that seems entirely unlikely.
    Last edited by dilettante; May 8th, 2012 at 04:08 PM.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2012
    Posts
    67

    Re: Mediafire API help

    Indeed, worthless example. The signature in their example isn't even real I think, they just put together some numbers. I'll try with hex.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Mediafire API help

    I agree with dilettante's suspicion, although I would suggest that the last step is unnecessary because the SHA1 function doesn't produce characters which require URL encoding.

    Why they bother with such a stupid parameter is another question.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2012
    Posts
    67

    Re: Mediafire API help

    I tried hex encoding it, didn't work. Tried base64, didn't work.
    I've finally gotten an answer from their support that their dev team is going to take a look at my question...sigh. Hopefully they will give me a correct answer asap.

    Worthless documentation is worthless...

  6. #6
    New Member
    Join Date
    May 2012
    Posts
    1

    Re: Mediafire API help

    Hi. I am the Lead Web Developer at MediaFire and the MediaFire API engineer.

    The signature is a sha1 of the 4 elements concatenated with NO spaces nor + signs

    Example: email: name@domain.com
    password: 123456
    application id: 1200
    api key : c1d62nzqu7z4rig15axe72jvczib53682kapu7lk

    the signature would be: SHA1(name@domain.com1234561200c1d62nzqu7z4rig15axe72jvczib53682kapu7lk)
    which is: f772724acc14117f3f69784a2f505d1560afaf64

    So the API call would look like (this is just an example): https://www.mediafire.com/api/user/g...505d1560afaf64

    Make sure the the application exists and that the app id corresponds to the api key. To create an App, visit your MediaFire account and go to "My Account > Developers" section. The API key is a secret key. Make sure you keep it private.

    Thank you.

  7. #7
    Registered User
    Join Date
    Aug 2014
    Posts
    2

    Post Re: Mediafire API help

    hi,i know this is really old thread but i need some help, so don't mind me.I am trying to use the get_info api to get the user information but i am having a problem generating a call signature(Session token 2).
    http://www.mediafire.com/developers/...call_signature
    I am reading the documentation given in the above link where it says to generate the call signature we need the formula
    The signature = the Message-Digest (MD5) of the 'secret_key' modulo 256 + 'time' + the URI of the API call. .
    I have the secret_key and time which i got from calling get_session_token api.The problem lies (i guess) in the URI of the API call.
    In my case , i wanted to call the get_info api , so i replace the URI with "/api/user/get_info.php" .But i got error saying i have invalid signature.What am i doing wrong here?

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Mar 2012
    Posts
    67

    Re: Mediafire API help

    Your best bet is to contact their support, or if rabie80 comes back here. Their documentation is still not flawless...

  9. #9
    Registered User
    Join Date
    Aug 2014
    Posts
    2

    Re: Mediafire API help

    ok, thanks for the reply

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width