Skip to content

Instantly share code, notes, and snippets.

@kevinpiac
Created September 2, 2017 12:22
Show Gist options
  • Save kevinpiac/9d77e1662f43ee7f852b685b78fd3fdb to your computer and use it in GitHub Desktop.
Save kevinpiac/9d77e1662f43ee7f852b685b78fd3fdb to your computer and use it in GitHub Desktop.
+ (NSString *)createLoginRequestWithUsername: (NSString *)username password: (NSString *)password
{
NSDictionary *params = @{
@"hashed_out_alphas" : @"[]",
@"height" : @"1334",
@"password" : password,
@"pre_auth_token" : @"",
@"reactivation_confirmed" : @false,
@"remember_device" : @true,
@"screen_height_in" : @"4.1",
@"screen_height_px" : @"667",
@"screen_width_in" : @"2.3",
@"screen_width_px" : @"375",
@"username" : username,
@"width" : @"750"
};
NSMutableDictionary *requestParams = [%c(SCAPI) _buildRequestParamForEndpoint:@"/loq/login" parameters:params authenticated:true];
SCAPIClient *scapi = [%c(SCAPIClient) sharedClient];
NSMutableURLRequest *urlRequest = [scapi requestWithMethod:@"POST" path:@"/loq/login" parameters:requestParams];
NSDictionary *requestHeader = [urlRequest allHTTPHeaderFields];
NSString *result = [[NSString alloc] initWithFormat:@"||%@||%@||%@||%@||%@||%@||%@||%@",
[requestHeader objectForKey:@"X-Snapchat-Client-Auth-Token"],
[requestHeader objectForKey:@"X-Snapchat-UUID"],
[requestParams objectForKey:@"req_token"],
[requestParams objectForKey:@"timestamp"],
[requestHeader objectForKey:@"User-Agent"],
[requestHeader objectForKey:@"X-Snapchat-Client-Token"],
[requestParams objectForKey:@"dsig"],
[requestParams objectForKey:@"dtoken1i"]];
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment