@loginradius/loginradius-react-sdk
v0.5.1
Published
A React SDK for integrating LoginRadius authentication and identity management
Maintainers
Readme
@loginradius/loginradius-react-sdk
A React SDK for integrating LoginRadius authentication and identity management into your React applications.
Installation
Install the SDK and its peer dependencies using your preferred package manager:
npm install @loginradius/loginradius-react-sdkRequirements
A LoginRadius account and API credentials (see LoginRadius Dashboard).
Setup
import { LoginRadiusProvider } from '@loginradius/loginradius-react-sdk';
function App() {
return (
<LoginRadiusProvider
config={{
apiKey: import.meta.env.VITE_LOGINRADIUS_API_KEY,
sott: import.meta.env.VITE_LOGINRADIUS_SOTT,
verificationUrl: import.meta.env.VITE_LOGINRADIUS_VERIFICATION_URL,
resetPasswordUrl: import.meta.env.VITE_LOGINRADIUS_RESET_PASSWORD_URL,
callbackUrl: import.meta.env.VITE_LOGINRADIUS_CALLBACK_URL
}}
>
{/* Your app components */}
</LoginRadiusProvider>
);
}
export default App;- LoginRadiusProvider: A context provider to initialize the SDK with your LoginRadius configuration.
Usage
Authentication Example Use the SDK's hooks or components to handle authentication:
import { AuthFlow } from '@loginradius/loginradius-react-sdk';
function LoginComponent() {
const handleSuccess = (response: AuthResponse) => {
console.log(' Success:', response);
};
const handleError = (error: ApiError) => {
console.error('Error:', error.error);
};
return (
<div>
<AuthFlow onSuccess={handleSuccess} onError={handleError} />
</div>
);
}See the LoginRadius Documentation for detailed more options.
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository: https://github.com/LoginRadius/loginradius-javascript
- Create a feature branch: git checkout -b feature/your-feature
- Commit your changes: git commit -m "Add your feature"
- Push to the branch: git push origin feature/your-feature
- Open a pull request.
Issues
Report bugs or suggest features via the GitHub Issues page.
License
This project is licensed under the MIT License.
Contact
For support, contact LoginRadius Support or visit https://www.loginradius.com.```
