Open hkors opened 7 years ago
Well done!
Do you mind sharing your code with u? So we have a working example.
@LordTiggy Check the other repository of @frdmn at https://github.com/gta5-map/Social-Club-example-parser. The code can be found in the index.js file. It is in Node.js, but I suppose it can be helpful for doing it in PHP using cURL or any other way you prefer.
Anyone found a working solution yet?
@crey4fun The node.js parser doesn't work for you?
Nope, logging in does not work due to the recaptcha I guess
The parser should notice if a captcha blocks the signin:
https://github.com/gta5-map/Social-Club-example-parser/blob/master/index.js#L274-L276
Update June 13, 2017: The login page is now protected by reCAPTCHA, so we receive a HTTP status code
403 Forbidden
now each time we login with this method. I haven't figured out a workaround for this.Hello people,
The described authentication steps didn't work for me, probably because R* has changed the way we sign into SocialClub. But finally I managed to construct the correct HTTP requests, so here are the steps I've taken for everyone who's facing the same problem:
Send a HTTP GET-request to
https://socialclub.rockstargames.com/profile/signin
, get the body and search for the hidden input field named__RequestVerificationToken
. Note that there are multiple fields with this name. The one in front of<li class="twitter">
is used. Get the value of this input field and remember this verification token. The returned cookies must also be saved to a cookie jar.Now it is time to get the authentication cookie. Send a HTTP POST-request to
https://socialclub.rockstargames.com/profile/signincompact
with the cookie jar and add the following HTTP headers to this request:The body of the request is a JSON string, as follows:
Again, store the cookies in the cookie jar. If status code
403 Forbidden
is returned, then you must sign into SocialClub manually on the same machine to get rid of the requested CAPTCHA. This CAPTCHA is requested for your IP address when you keep signing in a couple times during a short time. If status code429 Too Many Requests
is returned, you should wait a few minutes before trying it again. We should get status code200 OK
. If that is not the case, something went wrong, like missing required HTTP headers.If your credentials were invalid, you still receive status codeNowadays it seems like we get a status code200 OK
. To check whether the sign in was successful, check for the existence of a cookie namedAuthenticateCookie
.401 Unauthorized
when you provide invalid credentials.The cookie jar contains now the necessary cookies to retrieve the information you need. So if you want to get the information from
http://socialclub.rockstargames.com/games/gtav/career/overviewAjax?character=Freemode&nickname=<SOCIALCLUB_USERNAME>&slot=Freemode&gamerHandle=&gamerTag=&_=<TIMESTAMP>
, then send a HTTP GET-request to this URL with the cookie jar that contains theAuthenticateCookie
cookie after step 2.To each HTTP request I add the following HTTP headers (and override the
Accept
header in step 2):Some POST-requests require the verification token again in the body to some URL's of SocialClub.
I've created a Node.js script based on the gta5-map/Social-Club-example-parser project that uses these authentication steps. It can be found in this pull request: https://github.com/gta5-map/Social-Club-example-parser/pull/12