Javascript RenRen API

2019-09-09 10:44发布

问题:

I'm using the renren javascript API. to link a 3RD party app within an iframe to RenRen (the facebook of china). I've been able to authenticate and get an accessToken using

 Renren.ui({params});

Renren is inited when my document is ready. Renren.init({appId:appId});

So, in my authentication success handler, I want to request the logged in user's id. On the API it lists the parameters for a making a request, but not how to actually make it! I followed a link out that was supposed to be an example, but it is for the Java version, not js. http://wiki.dev.renren.com/wiki/API_Invocation

I'm using the built in translate feature in chrome to view the documentation. All i want is a clear example of how to make a request using their REST implementation. If i can get the response object, I think I can figure out how to parse it pretty easily.

In the JS documentation bundled with the zip file, i see:

 Renren.Request(options) or Renren.Request.Hidden(options) 

Would it work just like the UI version? Is this how I would get objects like a user?

The source for their JS API is here: http://wiki.dev.renren.com/wiki/Js-sdk-1.0#Documentation

回答1:

Since the JS API is broken (I emailed Renren and they said it is), Use the js API just to authenticate if you want to avoid using a backend API (which is even more confusing).

First, to get your application settings to save correctly turn off translation when submitting the form, enter Website Connect URL or you will get a redirect_uri error when you try to authenticate.

I was able to get the Flash API commands to work. If you're hacking it, remember that the "calculate sig" functionality actually take the WHOLE request minus sig and session key to make the signature key. Then you add the sig and submit the api request.