@asgardeo/auth-react 4.0.4 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -16
- package/dist/main.js +1 -1
- package/dist/src/models.d.ts +0 -4
- package/dist/src/models.d.ts.map +1 -1
- package/dist/src/public-api.d.ts +0 -1
- package/dist/src/public-api.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -6
- package/src/models.ts +0 -5
- package/src/public-api.ts +0 -1
- package/dist/src/secure-route.d.ts +0 -30
- package/dist/src/secure-route.d.ts.map +0 -1
- package/src/secure-route.tsx +0 -70
package/README.md
CHANGED
|
@@ -31,7 +31,6 @@ Asgardeo Auth React SDK allows React applications to use [OpenID Connect - OIDC
|
|
|
31
31
|
- [Authenticate users](#add-a-loginlogout-button)
|
|
32
32
|
- [Show Authenticated User's Information](#show-authenticated-users-information)
|
|
33
33
|
- [Retrieve Additional User Information](/API.md#getbasicuserinfo)
|
|
34
|
-
- [Secure Routes](/API.md#1-secureroute)
|
|
35
34
|
- [Secure Components](/API.md#3-authenticatedcomponent)
|
|
36
35
|
- [Send HTTP Requests to Asgardeo](/API.md#httprequest)
|
|
37
36
|
|
|
@@ -47,27 +46,18 @@ Follow this guide to integrate Asgardeo to your own React Application. To try ou
|
|
|
47
46
|
|
|
48
47
|
### 1. Installing the Package
|
|
49
48
|
|
|
50
|
-
Run the following command to install `@asgardeo/auth-react`
|
|
51
|
-
|
|
52
|
-
Use below command if you are using *React v16.8* or greater & *React Router v6*
|
|
49
|
+
Run the following command to install `@asgardeo/auth-react` from the npm registry.
|
|
53
50
|
|
|
54
51
|
```bash
|
|
55
|
-
npm install @asgardeo/auth-react
|
|
52
|
+
npm install @asgardeo/auth-react --save
|
|
56
53
|
```
|
|
57
|
-
Else if you are using *React v16.8* or greater & *React Router v5*, use below command
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
npm install @asgardeo/auth-react@1.1.19 react-router-dom@5.3.4 --save
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
> **Note**
|
|
64
|
-
> The `react-router-dom` package is a peer-dependency of the SDK and it is required to be installed for the SDK to work. We are working on making it optional.
|
|
65
54
|
|
|
66
55
|
### 2. Import [`AuthProvider`](/API.md#authprovider) and Provide [Configuration Parameters](/API.md#authreactconfig)
|
|
67
56
|
|
|
68
57
|
Asgardeo React SDK exposes the `AuthProvider` component, which helps you easily integrate Asgardeo to your application.
|
|
69
58
|
|
|
70
59
|
First, import the `AuthProvider` component from `@asgardeo/auth-react.` where you applications root component is defined.
|
|
60
|
+
|
|
71
61
|
> **Note**
|
|
72
62
|
> Typically the root component of a react app is defined in the index.* file.
|
|
73
63
|
|
|
@@ -76,7 +66,6 @@ import { AuthProvider } from "@asgardeo/auth-react";
|
|
|
76
66
|
```
|
|
77
67
|
Then, wrap your root component with the `AuthProvider`.
|
|
78
68
|
|
|
79
|
-
|
|
80
69
|
```TypeScript
|
|
81
70
|
import React from "react";
|
|
82
71
|
import { AuthProvider } from "@asgardeo/auth-react";
|
|
@@ -102,7 +91,6 @@ export const MyApp = (): ReactElement => {
|
|
|
102
91
|
|
|
103
92
|
Once the root component is wrapped with AuthProvider, [`useAuthContext()` hook](#useauthcontext-hook) can be used anywhere within the application to implement user authentication capabilities in the application.
|
|
104
93
|
|
|
105
|
-
|
|
106
94
|
## Using APIs
|
|
107
95
|
|
|
108
96
|
### Best practices when using APIs
|
|
@@ -118,7 +106,7 @@ Asgardeo Auth React SDK is built on top of [Asgardeo Auth SPA SDK](https://githu
|
|
|
118
106
|
<details><summary><strong>Click here for Tips:</strong> Do's When importing a component from Asgardeo React SDK</summary>
|
|
119
107
|
<p>
|
|
120
108
|
|
|
121
|
-
|
|
109
|
+
#### DO ✅
|
|
122
110
|
```TypeScript
|
|
123
111
|
import { AsgardeoSPAClient } from "@asgardeo/auth-react";
|
|
124
112
|
```
|