Click or drag to resize

KeeperSecurity.Authentication.Async Namespace

Provides types for connecting to Keeper servers (async).
Public classAuth Represents Keeper authentication. (async)
Public interfaceIAuthSsoUI Defines the methods required completing SSO Login. Optional.
Public interfaceIAuthUI Defines the user interface methods required for authentication with Keeper.
This example shows how to authenticate at Keeper server.
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using KeeperSecurity.Authentication;
using KeeperSecurity.Authentication.Async;
using KeeperSecurity.Configuration;

class AuthUi : IAuthUI
    public Task<bool> WaitForDeviceApproval(IDeviceApprovalChannelInfo[] channels, CancellationToken token)
        // find email device approval channel.
        var emailChannel = channels
            .FirstOrDefault(x => x.Channel == DeviceApprovalChannel.Email);
        if (emailChannel != null)
            // invoke send email action.
            _ = Task.Run(async () =>
                await emailChannel.InvokeDeviceApprovalPushAction();
        return new TaskCompletionSource<bool>().Task;
    public async Task<bool> WaitForTwoFactorCode(ITwoFactorChannelInfo[] channels, CancellationToken token)
        // find 2FA code channel.
        var codeChannel = channels
        if (codeChannel != null)
            Console.WriteLine("Enter 2FA code: ");
            var code = Console.ReadLine();
            await codeChannel.InvokeTwoFactorCodeAction("code");
            return true;
        return false;
    public async Task<bool> WaitForUserPassword(IPasswordInfo info, CancellationToken token)
        Console.WriteLine($"Enter password for {info.Username}: ");
        var password = Console.ReadLine();
        await info.InvokePasswordActionDelegate(password);
        return true;

internal static class Program
    private static async Task Main()
        var auth = new Auth(new AuthUi(), new JsonConfigurationStorage());
        await auth.Login("");
See Also