The Stytch .NET library makes it easy to use the Stytch user infrastructure API in .NET applications.
dotnet add package Stytch.net
You can find your API credentials in the Stytch Dashboard.
This client library supports all of Stytch's live products:
B2C
- Email Magic Links
- Embeddable Magic Links
- OAuth logins
- SMS passcodes
- WhatsApp passcodes
- Email passcodes
- Session Management
- WebAuthn
- User Management
- Time-based one-time passcodes (TOTPs)
- Crypto wallets
- Passwords
- M2M
B2B
- Organizations
- Members
- RBAC
- Email Magic Links
- OAuth logins
- Session Management
- Single-Sign On
- Discovery
- Passwords
- SMS OTP (MFA)
- M2M
Create an API client:
using Stytch.net.Clients;
var client = new Stytch.net.Clients.ConsumerClient(new ClientConfig
{
ProjectId = "project-live-c60c0abe-c25a-4472-a9ed-320c6667d317",
ProjectSecret = "secret-live-80JASucyk7z_G8Z-7dVwZVGXL5NT_qGAQ2I="
});
Send a magic link by email:
client.OTPs.Email.LoginOrCreate(new OTPsEmailLoginOrCreateRequest(email: "[email protected]"){
LoginMagicLinkUrl = "https://example.com/authenticate",
SignupMagicLinkUrl = "https://example.com/authenticate"
});
Authenticate the token from the magic link:
client.MagicLinks.Authenticate(new AuthenticateRequest(token: "DOYoip3rvIMMW5lgItikFK-Ak1CfMsgjuiCyI7uuU94="));
Create an API client:
using Stytch.net.Clients;
var client = new Stytch.net.Clients.B2BClient(new ClientConfig
{
ProjectId = "project-live-c60c0abe-c25a-4472-a9ed-320c6667d317",
ProjectSecret = "secret-live-80JASucyk7z_G8Z-7dVwZVGXL5NT_qGAQ2I="
});
Create an organization
client.Organizations.Create(new B2BOrganizationsCreateRequest(organizationName: "Acme Co"){
OrganizationSlug = "acme-co",
EmailAllowedDomains = ["acme.co"],
EmailJITProvisioning = "RESTRICTED"
});
Log the first user into the organization
client.MagicLinks.Email.LoginOrSignup(new B2BMagicLinksEmailLoginOrSignupRequest(){
OrganizationId = "organization-id-from-create-response-...",
EmailAddress = "[email protected]",
}));
If you've found a bug, open an issue!
If you have questions or want help troubleshooting, join us in Slack or email [email protected].
If you've found a security vulnerability, please follow our responsible disclosure instructions.
See DEVELOPMENT.md
Everyone interacting in the Stytch project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.