CodeAuthSDK 1.2.0
dotnet add package CodeAuthSDK --version 1.2.0
NuGet\Install-Package CodeAuthSDK -Version 1.2.0
<PackageReference Include="CodeAuthSDK" Version="1.2.0" />
<PackageVersion Include="CodeAuthSDK" Version="1.2.0" />
<PackageReference Include="CodeAuthSDK" />
paket add CodeAuthSDK --version 1.2.0
#r "nuget: CodeAuthSDK, 1.2.0"
#:package CodeAuthSDK@1.2.0
#addin nuget:?package=CodeAuthSDK&version=1.2.0
#tool nuget:?package=CodeAuthSDK&version=1.2.0
CodeAuth .NET SDK
Offical CodeAuth SDK. For more info, check the docs on our official website.
Installation
From within Visual Studio:
- Open the Solution Explorer.
- Right-click on a project within your solution.
- Click on Manage NuGet Packages...
- Click on the Browse tab and search for "CodeAuthSDK".
- Click on the CodeAuthSDK package, select the appropriate version in the right-tab and click Install.
OR
Using the .NET Core command-line interface (CLI) tools]
dotnet add package CodeAuthSDK
Basic Usage
Initialize CodeAuth SDK
using CodeAuthSDK;
CodeAuth.Initialize("<your project API endpoint>", "<your project ID>");
Signin / Email
Begins the sign in or register flow by sending the user a one time code via email.
var result = await CodeAuth.SignInEmail("<user email>");
switch (result.error)
{
case "bad_json": break;
case "project_not_found": break;
case "bad_ip_address": break;
case "rate_limit_reached": break;
case "bad_email": break;
case "code_request_interval_reached": break;
case "code_hourly_limit_reached": break;
case "email_provider_error": break;
case "internal_error": break;
case "connection_error": break; // sdk failed to connect to api server
}
Signin / Email Verify
Checks if the one time code matches in order to create a session token.
var result = await CodeAuth.SignInEmailVerify("<user email>", "<one time code>");
switch (result.error)
{
case "bad_json": break;
case "project_not_found": break;
case "bad_ip_address": break;
case "rate_limit_reached": break;
case "bad_email": break;
case "bad_code": break;
case "internal_error": break;
case "connection_error": break; // sdk failed to connect to api server
}
Console.WriteLine(result.session_token);
Console.WriteLine(result.email);
Console.WriteLine(result.expiration);
Console.WriteLine(result.refresh_left);
Signin / Social
Begins the sign in or register flow by allowing users to sign in through a social OAuth2 link.
var result = await CodeAuth.SignInSocial("<social type>");
switch (result.error)
{
case "bad_json": break;
case "project_not_found": break;
case "bad_ip_address": break;
case "rate_limit_reached": break;
case "bad_social_type": break;
case "internal_error": break;
case "connection_error": break; // sdk failed to connect to api server
}
Console.WriteLine(result.signin_url);
Signin / Social Verify
This is the next step after the user signs in with their social account. This request checks the authorization code given by the social media company in order to create a session token.
var result = await CodeAuth.SignInSocialVerify("<social type>", "<code>");
switch (result.error)
{
case "bad_json": break;
case "project_not_found": break;
case "bad_ip_address": break;
case "rate_limit_reached": break;
case "bad_social_type": break;
case "bad_code": break;
case "internal_error": break;
case "connection_error": break; // sdk failed to connect to api server
}
Console.WriteLine(result.session_token);
Console.WriteLine(result.email);
Console.WriteLine(result.expiration);
Console.WriteLine(result.refresh_left);
Session / Info
Gets the information associated with a session token.
var result = await CodeAuth.SessionInfo("<session_token>");
switch (result.error)
{
case "bad_json": break;
case "project_not_found": break;
case "bad_ip_address": break;
case "rate_limit_reached": break;
case "bad_session_token": break;
case "internal_error": break;
case "connection_error": break; // sdk failed to connect to api server
}
Console.WriteLine(result.email);
Console.WriteLine(result.expiration);
Console.WriteLine(result.refresh_left);
Session / Refresh
Create a new session token using existing session token.
var result = await CodeAuth.SessionRefresh("<session_token>");
switch (result.error)
{
case "bad_json": break;
case "project_not_found": break;
case "bad_ip_address": break;
case "rate_limit_reached": break;
case "bad_session_token": break;
case "out_of_refresh": break;
case "internal_error": break;
case "connection_error": break; // sdk failed to connect to api server
}
Console.WriteLine(result.session_token);
Console.WriteLine(result.email);
Console.WriteLine(result.expiration);
Console.WriteLine(result.refresh_left);
Session / Invalidate
Invalidate a session token. By doing so, the session token can no longer be used for any api call.
var result = await CodeAuth.SessionInvalidate("<session_token>", "<invalidate_type>");
switch (result.error)
{
case "bad_json": break;
case "project_not_found": break;
case "bad_ip_address": break;
case "rate_limit_reached": break;
case "bad_session_token": break;
case "bad_invalidate_type": break;
case "internal_error": break;
case "connection_error": break; // sdk failed to connect to api server
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.