SDKs overview
SAWO Labs offers a range of Software Development Kits (SDKs) designed to facilitate the integration of passwordless authentication into various applications. These SDKs simplify the implementation process by providing pre-built functions and interfaces that interact with the SAWO Labs authentication platform. Developers can use these tools to enable features such as OTP-less login, biometric authentication, and other secure, passwordless methods across different operating systems and programming environments SAWO Labs documentation.
The available SDKs cover major web and mobile development platforms, as well as several backend programming languages, allowing for comprehensive integration across full-stack applications. Each SDK is tailored to the conventions and ecosystems of its respective language or framework, aiming to provide a native development experience while abstracting the complexities of underlying authentication protocols like FIDO Alliance standards.
Official SDKs by language
SAWO Labs provides official SDKs for a variety of popular programming languages and frameworks. These SDKs are maintained by SAWO Labs and are designed to offer stable and feature-rich integration points for their authentication services. The table below lists the primary official SDKs, their typical package names, and the common installation commands.
| Language/Framework | Package/Module | Installation Command (Example) | Maturity |
|---|---|---|---|
| Android | com.sawolabs:android-sdk |
Add to build.gradle: implementation 'com.sawolabs:android-sdk:+' |
Stable |
| iOS | Sawolabs-iOS-SDK |
CocoaPods: pod 'Sawolabs-iOS-SDK' |
Stable |
| React Native | @sawolabs/react-native-sdk |
npm install @sawolabs/react-native-sdk |
Stable |
| Flutter | sawolabs_sdk |
flutter pub add sawolabs_sdk |
Stable |
| Web SDK (JavaScript) | @sawolabs/web-sdk |
npm install @sawolabs/web-sdk |
Stable |
| Node.js | @sawolabs/node-sdk |
npm install @sawolabs/node-sdk |
Stable |
| Python | sawolabs |
pip install sawolabs |
Stable |
| .NET | Sawolabs.SDK |
dotnet add package Sawolabs.SDK |
Stable |
| PHP | sawolabs/php-sdk |
composer require sawolabs/php-sdk |
Stable |
| Java | com.sawolabs:java-sdk |
Maven: Add dependency in pom.xml |
Stable |
Installation
Installing a SAWO Labs SDK typically involves adding the relevant package or library to your project's dependencies using the respective language's package manager. Detailed installation instructions and prerequisites for each SDK are available in the official SAWO Labs documentation portal SAWO Labs Web SDK get started guide. The general process often includes:
- Add the SDK dependency: Use a package manager like npm, Yarn, Gradle, CocoaPods, pip, or Composer to fetch and include the SDK in your project.
- Configure project settings: For mobile SDKs (Android, iOS, React Native, Flutter), this might involve updating manifest files, build settings, or linking native modules.
- Initialize the SDK: Implement code to initialize the SAWO Labs SDK with your API key and other configuration parameters, usually during application startup.
- Integrate authentication flow: Call SDK methods to initiate the passwordless login process when a user interacts with your application's login interface.
For example, a web application using the JavaScript SDK would typically add the package via npm, then initialize it with the SAWO Labs API key and callback URL.
Quickstart example
This quickstart example demonstrates a basic integration of the SAWO Labs Web SDK into a web application using JavaScript. This snippet configures the SDK and initiates the SAWO login modal. Detailed guides for all SDKs, including backend verification, are available on the SAWO Labs SDKs documentation page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SAWO Labs Web SDK Example</title>
<script src="https://cdn.jsdelivr.net/npm/@sawolabs/web-sdk@latest/dist/sawolabs.min.js"></script>
</head>
<body>
<div id="sawo-container" style="width:300px; height:auto;"></div>
<script>
const sawoConfig = {
containerID: 'sawo-container',
identifierType: 'PHONE_SMS',
apiKey: 'YOUR_API_KEY_HERE', // Replace with your actual SAWO API Key
onSuccess: (payload) => {
console.log('Login successful:', payload);
// You would typically send this payload to your backend for verification
alert('Login Successful! Check console for payload.');
},
onError: (error) => {
console.error('Login error:', error);
alert('Login Failed: ' + error.message);
}
};
// Initialize SAWO only after the DOM is fully loaded
document.addEventListener('DOMContentLoaded', () => {
try {
new Sawo(sawoConfig);
} catch (error) {
console.error('Failed to initialize SAWO:', error);
}
});
</script>
</body>
</html>
To use this example:
- Replace
'YOUR_API_KEY_HERE'with your actual SAWO API Key, obtained from your SAWO Labs dashboard SAWO Labs API reference. - Ensure your
identifierTypematches your desired login method (e.g.,'EMAIL','PHONE_SMS'). - The
onSuccesscallback receives the authentication payload, which should then be sent to your backend for verification to secure the session. This backend verification step is crucial for production environments and prevents client-side tampering.
Similar quickstart guides are available for other languages and frameworks, detailing how to integrate the SDK, handle authentication responses, and secure your application. For instance, a Node.js application might use the @sawolabs/node-sdk to verify the payload received from the frontend after a successful login SAWO Labs Node.js SDK guide.
Community libraries
While SAWO Labs maintains a comprehensive suite of official SDKs for major platforms, the open-source community may develop additional libraries, plugins, or integrations that extend SAWO Labs's functionality to other environments or provide specific framework适配s. These community contributions can offer tailored solutions for niche use cases or alternative approaches to integration.
Developers exploring community libraries should exercise due diligence, as these are not officially supported or vetted by SAWO Labs. It is advisable to check the library's documentation, community activity, and recent updates to ensure its reliability, security, and compatibility with the latest SAWO Labs API versions. The SAWO Labs GitHub organization is a good starting point to identify any officially endorsed or widely recognized community efforts.
Community contributions often arise for:
- Specific framework wrappers: For frameworks not directly covered by an official SDK.
- Utility functions: To simplify common tasks or integrate with other services.
- Demo applications: Illustrating advanced use cases or integration patterns.
When considering a community library, it is generally recommended to verify its licensing, review its source code for potential security vulnerabilities, and assess its maintenance status to ensure long-term viability and support. For production applications, relying on official SDKs is typically the recommended approach due to direct vendor support and guarantees of compatibility and security.