@corbado/react-sdk
Advanced tools
Comparing version 0.1.7-alpha.7 to 0.1.7-alpha.8
{ | ||
"name": "@corbado/react-sdk", | ||
"version": "0.1.7-alpha.7", | ||
"version": "0.1.7-alpha.8", | ||
"description": "This SDK is for developers who want to add Corbado's Authentication management in their applications but want to use a UI flow of their own.", | ||
@@ -38,9 +38,9 @@ "author": "Abdullah Shahbaz <abdullah_ghani@live.com>", | ||
"dependencies": { | ||
"@corbado/web-core": "^0.1.7-alpha.7" | ||
"@corbado/web-core": "^0.1.7-alpha.8" | ||
}, | ||
"devDependencies": { | ||
"@corbado/types": "^0.1.1-alpha.7", | ||
"@corbado/types": "^0.1.1-alpha.8", | ||
"@types/react": "^18.2.0" | ||
}, | ||
"gitHead": "9f2a2704a25bc41c53619e3026b0e927dc3663c9" | ||
"gitHead": "ac51a74caf6c815569b83894243f1aaa7d5d2071" | ||
} |
@@ -5,4 +5,4 @@ <img width="1070" alt="GitHub Repo Cover" src="https://github.com/corbado/corbado-php/assets/18458907/aa4f9df6-980b-4b24-bb2f-d71c0f480971"> | ||
[![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/corbado/javascript/blob/readme_documentation/LICENSE) | ||
[![Documentation](https://img.shields.io/badge/documentation-available-brightgreen)](https://docs.corbado.com/overview/welcome) | ||
[![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/corbado/javascript/blob/main/LICENSE) | ||
[![Documentation](https://img.shields.io/badge/documentation-available-brightgreen)](https://docs.corbado.com/frontend-integration/react) | ||
[![Slack](https://img.shields.io/badge/slack-community-blueviolet)](https://join.slack.com/t/corbado/shared_invite/zt-1b7867yz8-V~Xr~ngmSGbt7IA~g16ZsQ) | ||
@@ -77,3 +77,4 @@ [![npm version](https://img.shields.io/npm/v/@corbado/react)](https://www.npmjs.com/package/@corbado/react) | ||
Utilize the `useCorbado` hook to access authentication states like `user` and `shortSession`.: | ||
If you want to know if the user is currently authenticated or not make use of the `useCorbado` hook. | ||
Use `isAuthenticated` and `loading` to check the authentication state. | ||
@@ -84,3 +85,3 @@ ```tsx | ||
const HomePage = () => { | ||
const { user, shortSession, loading } = useCorbado(); | ||
const { loading, isAuthenticated } = useCorbado(); | ||
@@ -91,5 +92,6 @@ if (loading) { | ||
if (user) { | ||
if (isAuthenticated) { | ||
// Render authenticated state | ||
} | ||
// Additional implementation | ||
@@ -101,4 +103,26 @@ }; | ||
**Remember to check `loading` state of the hook before using authentication states** | ||
If you need more information about the user (e.g. name, email, etc.) use the `useCorbadoSession` hook. | ||
It also gives you access to the user's shortSession which you can use to make authenticated requests to your backend. | ||
```tsx | ||
import { useCorbadoSession } from '@corbado/react-sdk'; | ||
const HomePage = () => { | ||
const { loading, user } = useCorbadoSession(); | ||
if (loading) { | ||
// Render loading state | ||
} | ||
if (user) { | ||
// Render authenticated state | ||
} | ||
}; | ||
export default HomePage; | ||
``` | ||
**Remember to check `loading` state of the hook before using authentication states.** | ||
### Implementing Custom Authentication Flows | ||
@@ -239,3 +263,3 @@ | ||
For support and questions please visit our [Slack channel](https://join.slack.com/t/corbado/shared_invite/zt-1b7867yz8-V~Xr~ngmSGbt7IA~g16ZsQ). | ||
For more detailed information and advanced configuration options, please visit our [Documentation Page](https://docs.corbado.com/overview/welcome). | ||
For more detailed information and advanced configuration options, please visit our [Documentation Page](https://docs.corbado.com/frontend-integration/react). | ||
@@ -246,2 +270,2 @@ --- | ||
This project is licensed under the MIT License - see the [LICENSE](https://github.com/corbado/javascript/blob/readme_documentation/LICENSE) file for details. | ||
This project is licensed under the MIT License - see the [LICENSE](https://github.com/corbado/javascript/blob/main/LICENSE) file for details. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38112
265