Skip to content

Commit 1cdc1d0

Browse files
committed
increase version _ remove dead 2fa code
1 parent ca868d3 commit 1cdc1d0

File tree

2 files changed

+2
-40
lines changed

2 files changed

+2
-40
lines changed

lib/client/client_regular_account.dart

+1-39
Original file line numberDiff line numberDiff line change
@@ -370,44 +370,6 @@ class XRegularAccount extends ChangeNotifier {
370370
throw Exception("Return Status is (${response.statusCode}), it should be 200");
371371
}
372372

373-
Future<void> Pass2FA(String authCode, Map<String, String> userAgentHeader) async {
374-
var body = {
375-
"flow_token": flowTokenPassword,
376-
"subtask_inputs": [
377-
{
378-
"subtask_id": "LoginTwoFactorAuthChallenge",
379-
"enter_text": {"text": authCode, "link": "next_link"}
380-
}
381-
]
382-
};
383-
var request = http.Request("Post", Uri.parse('https://api.twitter.com/1.1/onboarding/task.json'));
384-
request.headers.addAll(userAgentHeader);
385-
request.headers.addAll({"content-type": "application/json"});
386-
request.headers.addAll({"authorization": bearerToken});
387-
request.headers.addAll({"x-guest-token": gtToken});
388-
request.headers.addAll({"Cookie": cookies.join(";")});
389-
request.headers.addAll({"Host": "api.twitter.com"});
390-
request.body = json.encode(body);
391-
var response = await client.send(request);
392-
if (response.statusCode == 200) {
393-
final stringData = await response.stream.transform(utf8.decoder).join();
394-
final exp = RegExp(r'flow_token":"(.+?)"');
395-
RegExpMatch? match = exp.firstMatch(stringData);
396-
flowToken2FA = match?.group(1).toString();
397-
} else if (response.statusCode == 400) {
398-
final stringData = await response.stream.transform(utf8.decoder).join();
399-
if (stringData.contains("errors")) {
400-
var parsedError = json.decode(stringData);
401-
var errors = StringBuffer();
402-
for (var error in parsedError["errors"]) {
403-
errors.writeln(error["message"] ?? "null");
404-
}
405-
throw Exception(errors);
406-
}
407-
} else
408-
throw Exception("2fa Return Status is (${response.statusCode}), it should be 200");
409-
}
410-
411373
Future<void> GetAuthTokenCsrf(Map<String, String> userAgentHeader) async {
412374
var body = {
413375
"flow_token": flowTokenPassword,
@@ -545,7 +507,7 @@ class XRegularAccount extends ChangeNotifier {
545507
await GetFlowToken2(userAgentHeader);
546508
await PassUsername(username, email);
547509
await PassPassword(password, userAgentHeader);
548-
//if (authCode != null) await Pass2FA(authCode.toString(), userAgentHeader);
510+
549511
await GetAuthTokenCsrf(userAgentHeader);
550512
await BuildAuthHeader();
551513
} on Exception catch (e) {

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1616
# Read more about iOS versioning at
1717
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
1818

19-
version: 3.4.1+300200120
19+
version: 3.4.2+300200124
2020

2121
environment:
2222
sdk: ">=2.18.0 <3.0.0"

0 commit comments

Comments
 (0)