Skip to content
This repository has been archived by the owner on Dec 16, 2020. It is now read-only.

Commit

Permalink
9.10 login changes
Browse files Browse the repository at this point in the history
  • Loading branch information
teknogeek committed Jun 21, 2015
1 parent f830a9c commit d6e5256
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/snapchat.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ public function device()
}
private function getAttestation($password, $timestamp)
{
$nonce = base64_encode(hash('sha256', "$this->username|$password|$timestamp|loq/login", true));
$hashString = $this->username."|{$password}|{$timestamp}|/loq/login";
$nonce = base64_encode(hash('sha256', $hashString, true));
$authentication = 'cp4craTcEr82Pdf5j8mwFKyb8FNZbcel';
$apkDigest = 'JJShKOLH4YYjWZlJQ71A2dPTcmxbaMboyfo0nsKYayE';

Expand Down Expand Up @@ -340,7 +341,7 @@ public function login($password, $force = FALSE)
return $auth;
}
parent::setGAuth($auth);
$attestation = $this->getAttestation($password, $timestamp);
$attestation = $this->getAttestation($password, $timestamp);

$result = parent::post(
'/loq/login',
Expand All @@ -356,7 +357,7 @@ public function login($password, $force = FALSE)
'ptoken' => "ie",
'timestamp' => $timestamp,
'attestation' => $attestation,
'sflag' => '1',
'sflag' => 1,
'application_id' => 'com.snapchat.android',
'req_token' => $req_token,
),
Expand Down
4 changes: 1 addition & 3 deletions src/snapchat_agent.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,6 @@ public function post($endpoint, $data, $params, $multipart = FALSE, $debug = FAL
curl_setopt($ch, CURLOPT_WRITEHEADER, $headerBuff);
curl_setopt($ch, CURLOPT_PROXY, $this->proxyServer);
$result = curl_exec($ch);


if(strlen($result) > 0) //make sure curl worked. if not, keep going
{
if($endpoint == "/loq/login") $result = gzdecode($result);
Expand Down Expand Up @@ -427,7 +425,7 @@ public function post($endpoint, $data, $params, $multipart = FALSE, $debug = FAL
{
$jsonResult = json_decode($result);
echo 'RESULT: ' . print_r($jsonResult) . "\n";
if ($jsonResult->status == '-103')
if (property_exists($jsonResult, "status") && $jsonResult->status == '-103')
exit();
}
else
Expand Down

0 comments on commit d6e5256

Please sign in to comment.