mgp25 / SC-API

Snapchat’s private API
MIT License
334 stars 103 forks source link

Google Auth error #207

Closed HW73 closed 9 years ago

HW73 commented 9 years ago

I'm not too sure what's going on. I've installed a fresh copy and moved to a server in my country to prevent being blocked by snapchat. Is anyone familiar with what I might be doing wrong?

REQUEST TO: https://feelinsonice-hrd.appspot.com/loq/device_id

Sent Request info: POST /loq/device_id HTTP/1.1
User-Agent: Snapchat/9.14.2.0 (HTC One; Android 4.4.2#302626.7#19; gzip)
Host: feelinsonice-hrd.appspot.com
Accept: */*
Accept-Language: en
Accept-Locale: en_US
X-Snapchat-Client-Auth-Token: Bearer
Content-Length: 98
Content-Type: application/x-www-form-urlencoded

DATA: timestamp=1442573747768&req_token=9309bb530f3131486e2214edf4a7a70419e34d85                                                                                                                                                             19b22a8ef9b45b14d1c5189b
RESULT: {"dtoken1i":"00001:BSFztJpyTMqmt7bOS4NagGXKnHDG97PzTFVtekeoQ24Sw/mRzDSDW                                                                                                                                                             QlV8z+VMjq+","dtoken1v":"PUm6CsssCWBSJ6D5UzNvmIRD4CspJzFUL3w/kqD8pd8\u003d"}

REQUEST TO: https://android.clients.google.com/auth
Array
(
    [device_country] => us
    [operatorCountry] => us
    [lang] => en_US
    [sdk_version] => 19
    [google_play_services_version] => 7097038
    [accountType] => HOSTED_OR_GOOGLE
    [Email] => singerhallbot@gmail.com
    [service] => audience:server:client_id:694893979329-l59f3phl42et9clpoo296d8r                                                                                                                                                             aqoljl6p.apps.googleusercontent.com
    [source] => android
    [androidId] => 378c184c6070c26c
    [app] => com.snapchat.android
    [client_sig] => 49f6badb81d89a9e38d65de76f09355071bd67e7
    [callerPkg] => com.snapchat.android
    [callerSig] => 49f6badb81d89a9e38d65de76f09355071bd67e7
    [EncryptedPasswd] => AFcb4KSBQwp04Nv-RVSY2mPrlkgoX1KT2qORT9kGibdGUgt27wETUOp                                                                                                                                                             oLiZzJzFuonOJycgIY-6kDpQp3AyBB8WnaktJut2gUiZrT5CwGc_eg6hf8nWvfM6IzCz85u2-bdB_Z8k                                                                                                                                                             4OtBVka0zBlepIc0SqWJCb9eDKcfbqrUdfqohzhTUYg==
)
DATA: 1
RESULT: Auth=eyJhbGciOiJSUzI1NiIsImtpZCI6IjZjYjUxZWZkZDQzNTJjNWRmMGFhOWYzZDNkZTN                                                                                                                                                             hMzg1M2Y2YjMzMzIifQ.eyJpc3MiOiJhY2NvdW50cy5nb29nbGUuY29tIiwiYXVkIjoiNjk0ODkzOTc5                                                                                                                                                             MzI5LWw1OWYzcGhsNDJldDljbHBvbzI5NmQ4cmFxb2xqbDZwLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQu                                                                                                                                                             Y29tIiwic3ViIjoiMTA2NTQyNDY0OTM0MTQ0NDUyNDE3IiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImF6                                                                                                                                                             cCI6IjY5NDg5Mzk3OTMyOS1xZzBpMHU4OHQwaG04azZrMW1icmJuc3VqMTAxaDczdi5hcHBzLmdvb2ds                                                                                                                                                             ZXVzZXJjb250ZW50LmNvbSIsImVtYWlsIjoic2luZ2VyaGFsbGJvdEBnbWFpbC5jb20iLCJpYXQiOjE0                                                                                                                                                             NDI1NzM3NDgsImV4cCI6MTQ0MjU3NzM0OH0.MLeRN_6JwRau1vof4W7f9LzwCnEf5iAxa8JC78S_rezf                                                                                                                                                             Pk1qOP2S6EN14D9E_wHHc60LI8BVtORQ5fNZhlQlB8_6KGku_JEK75vWoUZEA8GPOZ6goQPd-vq-He-H                                                                                                                                                             8AHD_PVco6AWIpW8VPXW_M8HdggSKlKnDh9rvXkTfhjyyLI5rsL2iUIa_P0jx60xmy1rtwAZcytUowXN                                                                                                                                                             rff04rsQlkISnNf19fSoh-HVJDb_5Evu3y2OjwlDABDPV2PRtBDbeCha1s26n2HsR4m6gTz-GcAPhhsu                                                                                                                                                             gxoDsYt77XzjUpgEeaU4Hw_llqhclVy1rKtUrFz9cWJMUmAVoPiDNdGEcA
issueAdvice=auto
Expiry=1442577348
storeConsentRemotely=1
mgp25 commented 9 years ago

There is a bug in Casper's gateway, it works, but you will need to try to login many times. For example, i tried 10 times til i succeed.

Anyway, it will be fixed, but for now just try (many times) to login

liamcottle commented 9 years ago

Yeah, sorry. I'm in the process of testing some changes to the internal code, because the internal bytes I've been using don't work properly anymore.

I've implemented some of Google's internal GPU code, which appears to have fixed the issue in Casper, and am still in the process of testing this on the servers.

Once I see it works properly, I'll push it to the live servers, and logins will work for you again.

Until then, there's not much any of you can do sorry.

HW73 commented 9 years ago

As long as it works that's fine :) Thanks for the help guys!

@liamcottle, thanks for all the work you're doing. I appreciate it

I just tried again and got this crazy error, I'll set a crontab up to try every 5 minutes.

(
    [message] => Oh no! Your login temporarily failed, so please try again later. If your login continues to fail, please visit https://support.snapchat.com/a/failed-login :)
    [status] => -103
    [logged] =>
liamcottle commented 9 years ago

Yeah, that issue is caused by receiving an invalid attestation value from the Google servers. The invalid attestation is caused by the internal byte arrays being wrong in my system.

I'll hopefully have the fix out in an hour or so.

I wouldn't suggest setting a cron tab for every 5 minutes, as this will get your IP banned, by making too many failed logins.

liamcottle commented 9 years ago

All servers have been updated with the new code.

Let me know if that solves the attestation issue for you.

Cheers.

HW73 commented 9 years ago

That's great Liam, i've just tested it and it works well. Just having a small problem where the users aren't being sent a message. Do you know how to save the images into a folder? I'm going to try get them to post to instagram too.

// Login
$tmpPath = '/tmp/';
$snapchat = new Snapchat($username, $gEmail, $gPasswd, $debug);
$snapchat->login($password);

if($addback == true) 
{
    $unconfirmed = $snapchat->getUnconfirmedFriends();
    if (!is_null($unconfirmed))
  {
    print_r($unconfirmed);
    foreach($unconfirmed as $friend)
    $snapchat->addFriendBack($friend);
  }
}

$snaps = $snapchat->getSnaps();

if (!is_null($snaps))
{
    foreach($snaps as $snap) 
    {
        echo "Processing SNAP ID [" . $snap->id . "]<br />";
        $snapchat->writeToFile('../src/snaps/' . $snap->id, $snapchat->getMedia($snap->id));
        $tmpFilePath = $tmpPath . $snap->id;
        file_put_contents($tmpFilePath, $snapchat->getMedia($snap->id));
        $snapchat->setStory($tmpFilePath, $snap->time);
        $snapchat->markSnapViewed($snap->id);
        unlink($tmpFilePath);
        $snapchat->sendMessage($snap->sender, "Your snap has been processed! Thank you for submitting & Please tell your friends!");
        echo "Processed!<br /><br />";
    }
}

$snapchat->closeAppEvent();
?>
mgp25 commented 9 years ago

@HW73 read the wiki and example files

emiliobasualdo commented 9 years ago

$Snapchat->getSnaps(true);

HW73 commented 9 years ago

@mgp25 @LanchaBasualdo thanks guys, I had a look and tried it out but the bot stopped working once I added that line in. Do I need show it where to save the snaps to?

emiliobasualdo commented 9 years ago

you can, but no. Post your code, and debug.

HW73 commented 9 years ago

I'm quite the noob when it comes to those things. I can't find any way to get the debug code, could you point me in the right direction please?

I've found an error log, probably not the right log

emiliobasualdo commented 9 years ago

Don't publish issues if you lack abilities, joel and mgp will get angry. Send me an email i'll show you. Never the less. Please read the wiki en the main page of this library, everything is explained there.

HW73 commented 9 years ago

Sorry guys, I've just dived in at the deep end trying to learn a few things. Thanks @LanchaBasualdo

mgp25 commented 9 years ago

@HW73 It's okay to learn things, we all have been begginners, but just because of that you need to read more.

The very first step is to read the whole wiki:https://github.com/mgp25/SC-API/wiki/Snap-API-Documentation

In the wiki you will find everything you need to know, and most of the things are explained. Once you know the theory you can go to the experimental part, so we prepared example files you can play with to test: https://github.com/mgp25/SC-API/tree/master/examples

If you have any other issue not tracked yet or not explained in the wiki its okay to ask, but not PHP questions, if you have questions about how to code something, the best thing you could do is google it or search it in PHP Manual: https://secure.php.net/manual/en/index.php

So this comment https://github.com/mgp25/SC-API/issues/207#issuecomment-141463717 could be answered just by reading the wiki: https://github.com/mgp25/SC-API/wiki/Snap-API-Documentation#logging-in

Regards

emiliobasualdo commented 9 years ago

@liamcottle @mgp25 are we still down or am I the only one with the attestation issue?

liamcottle commented 9 years ago

Attestation API should be working now. I just tested the PHP lib myself, and had to delete my src/authData/auth-*.dat file for Login to work.