@uipath/uipath-typescript 1.0.0-beta.13 → 1.0.0-beta.14
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 → README.md} +53 -10
- package/dist/index.d.ts +1323 -516
- package/dist/index.esm.js +1859 -1060
- package/dist/index.js +1859 -1059
- package/package.json +1 -1
package/{Readme.md → README.md}
RENAMED
|
@@ -37,31 +37,32 @@ const tasks = await sdk.tasks.getAll();
|
|
|
37
37
|
|
|
38
38
|
The SDK supports two authentication methods:
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
For OAuth, first create a non confidential [External App](https://docs.uipath.com/automation-cloud/automation-cloud/latest/admin-guide/managing-external-applications) with the required scopes and provide the clientId, redirectUri, and scope here.
|
|
41
|
+
|
|
42
|
+
### 1. OAuth Authentication
|
|
41
43
|
```typescript
|
|
42
44
|
const sdk = new UiPath({
|
|
43
45
|
baseUrl: 'https://cloud.uipath.com',
|
|
44
46
|
orgName: 'your-organization',
|
|
45
47
|
tenantName: 'your-tenant',
|
|
46
|
-
|
|
48
|
+
clientId: 'your-client-id',
|
|
49
|
+
redirectUri: 'your-redirect-uri',
|
|
50
|
+
scope: 'your-scopes'
|
|
47
51
|
});
|
|
52
|
+
|
|
53
|
+
// IMPORTANT: OAuth requires calling initialize()
|
|
54
|
+
await sdk.initialize();
|
|
48
55
|
```
|
|
49
56
|
|
|
50
|
-
For OAuth, first create a non confidential [External App](https://docs.uipath.com/automation-cloud/automation-cloud/latest/admin-guide/managing-external-applications) with the required scopes and provide the clientId, redirectUri, and scope here.
|
|
51
57
|
|
|
52
|
-
### 2.
|
|
58
|
+
### 2. Secret-based Authentication
|
|
53
59
|
```typescript
|
|
54
60
|
const sdk = new UiPath({
|
|
55
61
|
baseUrl: 'https://cloud.uipath.com',
|
|
56
62
|
orgName: 'your-organization',
|
|
57
63
|
tenantName: 'your-tenant',
|
|
58
|
-
|
|
59
|
-
redirectUri: 'your-redirect-uri',
|
|
60
|
-
scope: 'your-scopes'
|
|
64
|
+
secret: 'your-secret' //PAT Token or Bearer Token
|
|
61
65
|
});
|
|
62
|
-
|
|
63
|
-
// IMPORTANT: OAuth requires calling initialize()
|
|
64
|
-
await sdk.initialize();
|
|
65
66
|
```
|
|
66
67
|
|
|
67
68
|
## SDK Initialization - The initialize() Method
|
|
@@ -109,6 +110,42 @@ try {
|
|
|
109
110
|
}
|
|
110
111
|
```
|
|
111
112
|
|
|
113
|
+
## OAuth Integration Patterns
|
|
114
|
+
|
|
115
|
+
### Auto-login on App Load
|
|
116
|
+
```typescript
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
const initSDK = async () => {
|
|
119
|
+
const sdk = new UiPath({...oauthConfig});
|
|
120
|
+
await sdk.initialize();
|
|
121
|
+
};
|
|
122
|
+
initSDK();
|
|
123
|
+
}, []);
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### User-Triggered Login
|
|
127
|
+
```typescript
|
|
128
|
+
const onLogin = async () => {
|
|
129
|
+
await sdk.initialize();
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// Handle OAuth callback
|
|
133
|
+
const oauthCompleted = useRef(false);
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
if (sdk.isInitialized() && !oauthCompleted.current) {
|
|
136
|
+
oauthCompleted.current = true;
|
|
137
|
+
sdk.completeOAuth();
|
|
138
|
+
}
|
|
139
|
+
}, []);
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Available OAuth Methods
|
|
143
|
+
- `sdk.initialize()` - Start OAuth flow (auto completes also based on callback state)
|
|
144
|
+
- `sdk.isInitialized()` - Check if SDK initialization completed
|
|
145
|
+
- `sdk.isAuthenticated()` - Check if user has valid token
|
|
146
|
+
- `sdk.isInOAuthCallback()` - Check if processing OAuth redirect
|
|
147
|
+
- `sdk.completeOAuth()` - Manually complete OAuth (advanced use)
|
|
148
|
+
|
|
112
149
|
## Available Services
|
|
113
150
|
|
|
114
151
|
The SDK provides access to the following services through a consistent API:
|
|
@@ -255,6 +292,12 @@ if (page5.supportsPageJump) {
|
|
|
255
292
|
}
|
|
256
293
|
```
|
|
257
294
|
|
|
295
|
+
## Samples
|
|
296
|
+
|
|
297
|
+
Check out the [`/samples`](./samples) folder to see sample applications built using the SDK:
|
|
298
|
+
|
|
299
|
+
- **[process-app](./samples/process-app)**: A Maestro process management application demonstrating OAuth authentication and SDK usage
|
|
300
|
+
|
|
258
301
|
## Development
|
|
259
302
|
|
|
260
303
|
Before submitting a pull request, please review our [Contribution Guidelines](https://uipath.github.io/uipath-typescript/CONTRIBUTING/).
|