llamauth
v2.0.6
Published
**llamauth** is a lightweight and secure OAuth library designed to simplify authentication with popular providers like Google, GitHub, and Microsoft. It enables seamless integration with your React applications while maintaining security and ease of use.
Readme
llamauth
llamauth is a lightweight and secure OAuth library designed to simplify authentication with popular providers like Google, GitHub, and Microsoft. It enables seamless integration with your React applications while maintaining security and ease of use.
Official Documentation
Visit the official documentation at Llamauth Documentation
🚀 Installation
npm install llamauthCreating Tools
Create your Oauth Tools from: llamauth Tool Launchpad
🌟 Features
- Simple integration with minimal setup
- Secure OAuth authentication flow
- Works seamlessly with React applications
📦 Usage
import React, { useState } from "react";
import { loginWithLamauth } from "llamauth";
const SignIn = () => {
const [isLoading, setIsLoading] = useState(false);
const handleLogin = async (token) => {
console.log(token);
return handleAuthLogin(token, "google");
};
return (
<div>
<button
onClick={() =>
loginWithLamauth({
key: "<API-KEY>",
callback: githubAuthLogin,
uuid: "<TOOL-ID from llamauth>",
})
}
variant="secondary"
> Sign in with Github
</button>
);
};
export default SignIn;⚙️ Configuration
The loginWithLamauth function accepts the following options:
| Option | Type | Description | |-----------|--------|------------------------------------| | apiKey | string | Your API key provided by llamauth | | toolId | string | The tool ID for your application | | provider | string | OAuth provider: 'google', 'github', or 'microsoft' |
📄 API Reference
loginWithLamauth(options)
Parameters:
apiKey(required): Your llamauth API key.toolId(required): The tool ID associated with your app.provider(required): The OAuth provider to authenticate with.
Returns:
- A promise that resolves with the authentication result.
❗ Error Handling
Ensure you handle errors gracefully:
try {
const response = await loginWithLamauth({ apiKey: "<API-KEY>", toolId: "<TOOL-ID>", provider: "github" });
if (response.error) {
console.error("Authentication failed:", response.error);
}
} catch (err) {
console.error("Unexpected error:", err);
}💡 Contributing
Contributions are welcome! Please open issues or submit pull requests for new features, bug fixes, or improvements.
📜 License
This project is licensed under the MIT License.
Made with ❤️ by the llamauth team.
