createCredential method

Future<FirebaseAppAuthCredential> createCredential({
  1. String? eventId,
  2. String? sessionId,
  3. String? providerId,
  4. String? link,
})

Implementation

Future<FirebaseAppAuthCredential> createCredential(
    {String? eventId,
    String? sessionId,
    String? providerId,
    String? link}) async {
  var box = await PersistenceStorage.openBox('firebase_auth');
  sessionId = sessionId ?? box.get('redirect_session_id');

  if (eventId != null) {
    var storedEventId = box.get('redirect_event_id');
    if (storedEventId != eventId) {
      throw FirebaseAuthException.noAuthEvent();
    }
    await box.delete('redirect_event_id');
  }

  return FirebaseAppAuthCredential(
      providerId: providerId ?? 'unknown',
      sessionId: sessionId!,
      link: link!);
}