internal static FirebaseTokenFactory Create(FirebaseApp app, string tenantId = null)
        {
            ISigner signer         = null;
            var     serviceAccount = app.Options.Credential.ToServiceAccountCredential();

            if (serviceAccount != null)
            {
                // If the app was initialized with a service account, use it to sign
                // tokens locally.
                signer = new ServiceAccountSigner(serviceAccount);
            }
            else if (string.IsNullOrEmpty(app.Options.ServiceAccountId))
            {
                // If no service account ID is specified, attempt to discover one and invoke the
                // IAM service with it.
                signer = IAMSigner.Create(app);
            }
            else
            {
                // If a service account ID is specified, invoke the IAM service with it.
                signer = FixedAccountIAMSigner.Create(app);
            }

            return(new FirebaseTokenFactory(signer, SystemClock.Default, tenantId));
        }
        internal static FirebaseTokenFactory Create(FirebaseApp app, string tenantId = null)
        {
            ISigner signer         = null;
            var     serviceAccount = app.Options.Credential.ToServiceAccountCredential();

            if (serviceAccount != null)
            {
                // If the app was initialized with a service account, use it to sign
                // tokens locally.
                signer = new ServiceAccountSigner(serviceAccount);
            }
            else if (string.IsNullOrEmpty(app.Options.ServiceAccountId))
            {
                // If no service account ID is specified, attempt to discover one and invoke the
                // IAM service with it.
                signer = IAMSigner.Create(app);
            }
            else
            {
                // If a service account ID is specified, invoke the IAM service with it.
                signer = FixedAccountIAMSigner.Create(app);
            }

            var args = new Args
            {
                Signer         = signer,
                TenantId       = tenantId,
                IsEmulatorMode = Utils.IsEmulatorModeFromEnvironment,
            };

            return(new FirebaseTokenFactory(args));
        }