Flows Auth is a robust authentication library designed for Svelte applications. It provides seamless integration of WebAuthn and passkey support specifically tailored for Thepia Flow applications. This library simplifies the process of implementing secure authentication mechanisms, allowing developers to focus on building their applications without worrying about the intricacies of authentication.
To install Flows Auth, you can use npm or yarn. Run one of the following commands in your terminal:
npm install flows-auth
or
yarn add flows-auth
To use Flows Auth in your Svelte application, import the library and initialize it. Here’s a simple example:
import { Auth } from 'flows-auth';
const auth = new Auth({
// Configuration options
clientId: 'your-client-id',
redirectUri: 'your-redirect-uri',
});
// Initiate login
auth.login();
Option | Type | Description |
---|---|---|
clientId |
string | Your application's client ID. |
redirectUri |
string | The URI to redirect after login. |
scopes |
array | The scopes you want to request. |
constructor(options: AuthOptions)
Creates a new instance of the Auth class.
options
: An object containing configuration options.login()
Initiates the login process.
logout()
Logs the user out of the application.
getUser()
Returns the currently authenticated user.
Here’s a simple example demonstrating the login flow:
import { Auth } from 'flows-auth';
const auth = new Auth({
clientId: 'your-client-id',
redirectUri: 'your-redirect-uri',
});
async function handleLogin() {
try {
await auth.login();
const user = auth.getUser();
console.log('Logged in user:', user);
} catch (error) {
console.error('Login failed:', error);
}
}
handleLogin();
To log the user out, you can call the logout
method:
async function handleLogout() {
try {
await auth.logout();
console.log('User logged out');
} catch (error) {
console.error('Logout failed:', error);
}
}
handleLogout();
We welcome contributions to Flows Auth! If you want to contribute, please follow these steps:
git checkout -b feature/YourFeature
).git commit -m 'Add some feature'
).git push origin feature/YourFeature
).Please ensure that your code adheres to our coding standards and includes tests where applicable.
This project is licensed under the MIT License. See the LICENSE file for details.
For the latest releases, please visit the Releases section. You can download the latest version and execute it in your application.
For questions or feedback, feel free to open an issue in the repository or contact the maintainer directly.
Feel free to explore the repository and integrate Flows Auth into your Svelte applications. We hope this library helps you streamline your authentication processes effectively.