Build on Benten
One SDK for your website, your mobile apps and your backend services
The Benten SDK is a small, open-source .NET library. Your code sends an approval request, Benten pushes it to the user's phone, and your code gets back Allow, Deny or NoResponse.
Websites
Call Benten from your ASP.NET Core site or API to approve sign-ins, checkouts and account changes.
- Works with ASP.NET Core, minimal APIs, MVC and Razor Pages
- Your Benten API key stays on your server
Android & iOS apps
Add Benten approval to your .NET MAUI app. Your app calls your backend, and your backend calls Benten through the SDK.
- .NET MAUI on Android and iOS
- On-device passcodes with
Benten.PassCode
Services & desktop
Protect admin tools, payment workers, IoT controllers and Windows apps. Anything that runs .NET 8 can use the SDK.
- Windows, Linux and macOS
- A working Windows sample app is included
How it works
You write a few lines of code. Benten runs the rest.
Benten runs the API, the push delivery and the patented authentication (#10,299,118). You don't host or maintain any of it.
RequestLoginApprovalAsync(…) sends the request and waits for the answer.
Requests go over secure WebSockets (wss://). If the user doesn't answer within 60 seconds, the result is NoResponse, so your code never hangs.
What's included
What's open, what's packaged and what Benten hosts
You install NuGet packages and call a hosted API. You never need Benten's server code.
Benten.SDK
The .NET client library: authentication, approval requests and typed results. The source is on GitHub, so you can read exactly what your app sends.
dotnet add package Benten.SDKBenten.PassCode
Benten's native passcode engine, packaged for .NET. It includes prebuilt binaries for Android, iOS and Windows x64, so there's nothing to compile. The source is not published.
dotnet add package Benten.PassCodeBenten API
The private service behind the platform. It handles tokens, device lookup, push delivery and the approval workflow. Benten runs, secures and scales it for you.
Your users approve requests in the free Benten App, available on the App Store and Google Play.
Quickstart
Your first approval request in four steps
Create a developer account
Sign up on the Developer Portal. After you confirm your email and Benten verifies your phone number, sign in and create an API key on the dashboard. To test, install the Benten App on your own phone and register it.
Install the SDK
Add the package to your web project or backend service. The SDK targets .NET 8 and later.
dotnet add package Benten.SDK
Keep your API key on the server
Store the API key in user secrets, environment variables or a key vault. Don't put it in a mobile app or in browser JavaScript. Your username and password are only for signing in to the dashboard.
dotnet user-secrets set "Benten:ApiKey" "bnt_sk_your-api-key"
Request an approval
Choose where your code runs:
using Benten.SDK;
using Benten.SDK.Models;
var builder = WebApplication.CreateBuilder(args);
// One client for the whole app: it gets and renews its access token from your API key
builder.Services.AddSingleton(new BentenClient(builder.Configuration["Benten:ApiKey"]!));
var app = builder.Build();
// Called by your sign-in page after the user enters their email
app.MapPost("/signin/approve", async (LoginAttempt attempt, BentenClient benten) =>
{
// 1. Ask the user to approve the sign-in on their phone
BentenResult result = await benten.RequestLoginApprovalAsync(new LoginRequest
{
Country = attempt.Country, // e.g. "United States"
PhoneNumber = attempt.PhoneNumber, // e.g. "6501234567"
Username = attempt.Email // shown on the notification
});
// 2. Only sign the user in if they tapped Allow
return result.IsApproved ? Results.Ok() : Results.Unauthorized();
});
app.Run();
record LoginAttempt(string Email, string Country, string PhoneNumber);
Your sign-in page posts to /signin/approve and waits. When the user taps Allow, you issue your normal session cookie or token.
// The app calls YOUR backend, which uses Benten.SDK (see the Website tab).
// No Benten API key is stored on the phone.
var http = new HttpClient { BaseAddress = new Uri("https://api.yourcompany.com/") };
var response = await http.PostAsJsonAsync("signin/approve", new
{
Email = EmailEntry.Text,
Country = "United States",
PhoneNumber = PhoneEntry.Text
});
if (response.IsSuccessStatusCode)
await Shell.Current.GoToAsync("//home"); // approved on the user's phone
else
await DisplayAlert("Sign-in not approved", "The request was denied or timed out.", "OK");
// dotnet add package Benten.PassCode
using Benten.PassCode;
using var generator = new PassCodeGenerator();
string passcode = generator.Generate(deviceUuid, clientSpecificValue);
The same approach works for any mobile app: the app calls your backend, and your backend calls Benten through the SDK.
using Benten.SDK;
using Benten.SDK.Models;
var benten = new BentenClient(Environment.GetEnvironmentVariable("BENTEN_API_KEY")!);
var result = await benten.RequestLoginApprovalAsync(new LoginRequest
{
Country = "United States",
PhoneNumber = "6501234567",
Username = "alice@example.com"
});
Console.WriteLine(result.IsApproved ? "Approved" : $"Not approved: {result.Response}");
For a complete example with every request type, clone the Windows sample: benten-client-sample.
Use cases
One method per kind of approval
Each method sends a push notification with the details you provide and returns the user's answer.
Passwordless sign-in
Replace passwords and SMS codes with a tap on the user's phone.
await benten.RequestLoginApprovalAsync(
new LoginRequest
{
Country = "United States",
PhoneNumber = "6501234567",
Username = "alice@example.com"
});
Card transactions
Ask the cardholder to confirm a purchase, online or at the point of sale.
await benten.RequestCCTransactionApprovalAsync(
new CCTransactionRequest
{
CreditCardId = cardId, // from card registration
Amount = "$149.99",
Retailer = "www.example-store.com"
});
IoT setting changes
Ask the owner to approve a change before a thermostat, lock or camera applies it.
await benten.RequestIoTSettingApprovalAsync(
new IoTSettingRequest
{
Name = "Living Room Thermostat",
MacAddress = "AA:BB:CC:DD:EE:01",
SettingChange = "Set temperature to 68°F"
});
Any custom approval
Show up to three labelled lines for any other workflow, such as access to medical records, document sign-off or admin actions.
await benten.RequestGenericNotificationApprovalAsync(
new GenericNotificationRequest
{
NotificationSubType = "Medical Records",
Country = "United States", PhoneNumber = "6501234567",
Line1Placeholder = "Doctor", Line1 = "Dr. Jane Smith",
Line2Placeholder = "Patient", Line2 = "John Doe",
Line3Placeholder = "Reason", Line3 = "Review test results"
});
Handling results
Every request returns one of four outcomes
Every approval method returns a BentenResult. Check its properties instead of comparing strings. Network and protocol failures throw a BentenException, so you can handle them separately.
Only proceed when IsApproved is true. Treat every other outcome as not approved.
| Property | Meaning |
|---|---|
IsApproved | The user tapped Allow. |
IsDenied | The user tapped Deny. |
IsTimedOut | The user didn't respond within 60 seconds (NoResponse). |
HasError | Benten returned a BSCxxxx status code. See the Developers Guide. |
FAQ
Common questions
Do I need to host any Benten servers?
No. Benten runs the Benten API. You install the SDK and call it from your code.
Is the Benten API open source?
No. The source code of the Benten API and of the Benten.PassCode native engine stays private. Benten.PassCode is available as a prebuilt NuGet package. The client SDK is open source under the MIT license, so you can inspect everything your application sends.
Can I call Benten directly from my mobile app?
Send approval requests from your backend. Your API key authorizes requests to your users' phones, and anything shipped inside an app can be extracted. Your mobile app should call your own API, which uses the SDK.
What do my users need?
The free Benten App on iOS or Android, with their phone number registered. Benten sends every approval request to that app.
Can I see the Benten App's source code?
The Benten App's source isn't public, but it's available on request under a proprietary license. You can read it and run it on your own devices to test your integration, but not copy, modify or republish it. To request access, email support@bententechnologies.com.
I don't use .NET. Can I still integrate?
Yes. The SDK wraps a documented HTTPS and WebSocket protocol. The Developers Guide lists every endpoint, parameter and status code, so you can call it from any language.
How do I get help?
Contact us or email support@bententechnologies.com. To report an SDK bug, open an issue on GitHub.
Ready to stop using passwords?
Create a free developer account and send your first approval request in minutes.