Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

"Buy Me A Coffee"

Maui.CredentialManager

NuGet Version NuGet Downloads Build codecov Last updated Twitter

Cross-platform .NET MAUI library for unified credential management on Android and iOS.

Installation

dotnet add package Kebechet.Maui.CredentialManager

Usage

Registration

builder.Services.AddCredentialManagerService(options =>
{
    options.GoogleServerClientId = "xxx.apps.googleusercontent.com";
    options.AppleServiceId = "com.myapp.auth";
    options.AppleRedirectUri = "https://myserver.com/auth/apple/callback";

    options.Ios.GoogleClientId = "yyy.apps.googleusercontent.com";
    options.Ios.GoogleRedirectUri = "com.myapp:/oauth2redirect";

    options.Android.AppleCallbackScheme = "com.myapp:/applecallback";
});

Inject and use

@inject ICredentialManagerService CredentialManagerService

// Save password
await CredentialManagerService.CreatePasswordCredential(
    new PasswordCredentialDto { Id = "user@example.com", Password = "secret" },
    cancellationToken);

// Retrieve password
var result = await CredentialManagerService.GetPasswordCredential(cancellationToken);

// SSO (Google on Android, Apple on iOS by default)
var ssoResult = await CredentialManagerService.ContinueWithSso(
    SsoProvider.PlatformDefault, cancellationToken);

// Clear credential state
await CredentialManagerService.ClearCredentialState(cancellationToken);

Supported Platforms

Feature Android iOS
Password credentials Credential Manager API Keychain Services
Google Sign-In Native (Credential Manager) WebAuthenticator
Apple Sign-In WebAuthenticator Native (ASAuthorization)
Clear credential state ClearCredentialState API Keychain removal

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages