@asgardeo/javascript 0.2.5 → 0.2.6

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 CHANGED
@@ -8,50 +8,11 @@
8
8
  <a href="./LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License"></a>
9
9
  </div>
10
10
 
11
- ## Installation
12
-
13
- ```bash
14
- # Using npm
15
- npm install @asgardeo/javascript
16
-
17
- # or using pnpm
18
- pnpm add @asgardeo/javascript
19
-
20
- # or using yarn
21
- yarn add @asgardeo/javascript
22
- ```
23
-
24
- ## Quick Start
25
-
26
- ```javascript
27
- import { AsgardeoAuth } from "@asgardeo/javascript";
28
-
29
- // Initialize the auth instance
30
- const auth = new AsgardeoAuth({
31
- afterSignInUrl: "https://localhost:3000",
32
- clientId: "<your_client_id>",
33
- baseUrl: "https://api.asgardeo.io/t/<org_name>"
34
- });
35
-
36
- // Handle authentication
37
- auth.signIn()
38
- .then(() => {
39
- // Handle successful sign in
40
- })
41
- .catch((error) => {
42
- // Handle sign in error
43
- });
44
-
45
- // Get authenticated user
46
- auth.getUser()
47
- .then((userInfo) => {
48
- console.log(userInfo);
49
- });
50
-
51
- // Sign out
52
- auth.signOut();
53
- ```
11
+ > [!IMPORTANT]
12
+ > ⚠️ Do not directly use this in your applications.
13
+ > `@asgardeo/javascript` is a framework agnostic SDK that provides core authentication functionalities.
14
+ > For framework-specific integrations, consider using the dedicated SDKs such as `@asgardeo/react`, `@asgardeo/next`, etc.
54
15
 
55
16
  ## License
56
17
 
57
- Apache-2.0
18
+ Licenses this source under the Apache License, Version 2.0 [LICENSE](./LICENSE), You may not use this file except in compliance with the License.
@@ -71,6 +71,23 @@ export interface BaseConfig<T = unknown> extends WithPreferences {
71
71
  * For production: "https://your-app.com/api/auth/signout"
72
72
  */
73
73
  afterSignOutUrl?: string | undefined;
74
+ /**
75
+ * A list of external API base URLs that the SDK is allowed to attach access tokens to when making HTTP requests.
76
+ *
77
+ * When making authenticated HTTP requests using the SDK's HTTP client, the access token will only be attached
78
+ * to requests whose URLs start with one of these specified base URLs. This provides a security layer by
79
+ * preventing tokens from being sent to unauthorized servers.
80
+ *
81
+ * @remarks
82
+ * - This is only applicable when the storage type is `webWorker`.
83
+ * - Each URL should be a base URL without trailing slashes (e.g., "https://api.example.com").
84
+ * - The SDK will check if the request URL starts with any of these base URLs before attaching the token.
85
+ * - If a request is made to a URL that doesn't match any of these base URLs, an error will be thrown.
86
+ *
87
+ * @example
88
+ * allowedExternalUrls: ["https://api.example.com", "https://api.another-service.com"]
89
+ */
90
+ allowedExternalUrls?: string[];
74
91
  /**
75
92
  * Optional organization handle for the Organization in Asgardeo.
76
93
  * This is used to identify the organization in the Asgardeo identity server in cases like Branding, etc.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asgardeo/javascript",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Framework agnostic JavaScript SDK for Asgardeo.",
5
5
  "keywords": [
6
6
  "asgardeo",