completeLogin function

Future<List> completeLogin(
  1. GarthClient client
)

Implementation

Future<List<dynamic>> completeLogin(GarthClient client) async {
  final ticketRe = RegExp(r'embed\?ticket=([^"]+)"');
  final match = ticketRe.firstMatch(client.lastResp!.body);
  if (match == null) {
    throw GarthException("Couldn't find ticket in response");
  }
  final ticket = match.group(1)!;

  final oauth1 = await getOauth1Token(ticket, client);
  final oauth2 = await exchange(oauth1, client);

  return [oauth1, oauth2];
}