@autional/api-oauth 0.2.0
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 +53 -0
- package/package.json +36 -0
- package/src/index.ts +200 -0
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @authms/api-identity
|
|
2
|
+
|
|
3
|
+
AuthMS Identity Service API — auto-generated TypeScript client for identity-service (21 functions).
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
| Function | Description |
|
|
8
|
+
|----------|-------------|
|
|
9
|
+
| `login(client, data)` | Authenticate with email/phone/username and password |
|
|
10
|
+
| `register(client, data)` | Register a new user account |
|
|
11
|
+
| `refreshToken(client, data)` | Refresh access token using refresh token |
|
|
12
|
+
| `getProfile(client)` | Get current user profile |
|
|
13
|
+
| `updateProfile(client, data)` | Update current user profile |
|
|
14
|
+
| `logout(client)` | Logout and revoke tokens |
|
|
15
|
+
| `verifyEmail(client, data)` | Verify email with verification code |
|
|
16
|
+
| `sendVerificationEmail(client, data)` | Send email verification code |
|
|
17
|
+
| `changePassword(client, data)` | Change password (requires current password) |
|
|
18
|
+
| `forgotPassword(client, data)` | Request password reset email |
|
|
19
|
+
| `resetPassword(client, data)` | Reset password with token from email |
|
|
20
|
+
| `checkPermission(client, data)` | Check if user has a specific permission |
|
|
21
|
+
| `getPermissions(client)` | Get user's permission list |
|
|
22
|
+
| `getTenants(client)` | Get user's tenants |
|
|
23
|
+
| `switchTenant(client, data)` | Switch active tenant |
|
|
24
|
+
| `requestRoleActivation(client, data)` | Request PIM/JIT role activation |
|
|
25
|
+
| `getRoleActivations(client)` | Get active role activations |
|
|
26
|
+
| `deleteAccount(client)` | Delete current user account |
|
|
27
|
+
| `getSessions(client)` | Get user's sessions |
|
|
28
|
+
| `deleteSession(client, sessionId)` | Delete a specific session |
|
|
29
|
+
| `getMFAMethods(client)` | Get user's MFA methods |
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install @authms/core @authms/api-identity
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { AuthMS, browserPlatform } from '@authms/core';
|
|
41
|
+
import { login, getProfile } from '@authms/api-identity';
|
|
42
|
+
|
|
43
|
+
const authms = new AuthMS({ appId: 'my-app', issuer: 'https://auth.iam.tianv.com', platform: browserPlatform });
|
|
44
|
+
await authms.initialize();
|
|
45
|
+
|
|
46
|
+
const result = await login(authms.api, { email: 'user@example.com', password: 's3cret' });
|
|
47
|
+
console.log(result.user);
|
|
48
|
+
|
|
49
|
+
const profile = await getProfile(authms.api);
|
|
50
|
+
console.log(profile);
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
See the [root SDK README](../../README.md) for full documentation.
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@autional/api-oauth",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "AuthMS Identity Service API \u2014 auto-generated TypeScript client",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --clean --external @autional/core",
|
|
18
|
+
"typecheck": "tsc --noEmit",
|
|
19
|
+
"clean": "rimraf dist"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"src"
|
|
24
|
+
],
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@autional/core": ">=0.1.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@autional/core": ">=0.1.0",
|
|
30
|
+
"rimraf": "^5.0.0",
|
|
31
|
+
"tsup": "^8.4.0",
|
|
32
|
+
"typescript": "^5.8.0",
|
|
33
|
+
"vitest": "^3.0.0"
|
|
34
|
+
},
|
|
35
|
+
"license": "MIT"
|
|
36
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// @ts-nocheck — auto-generated from swagger.json
|
|
2
|
+
/** @authms/api-oauth — auto-generated */
|
|
3
|
+
import type { ApiClient } from '@authms/core';
|
|
4
|
+
|
|
5
|
+
export function adminOauthClients(client: ApiClient, data?: Record<string, unknown>) {
|
|
6
|
+
return client.get(`/oauth/api/v1/admin/oauth/clients`, { params });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function adminOauthClientsPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
10
|
+
return client.post(`/oauth/api/v1/admin/oauth/clients`, data);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function adminOauthClientsByClientsDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
14
|
+
return client.delete(`/oauth/api/v1/admin/oauth/clients/${clientId}`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function adminOauthClientsByClients(client: ApiClient, data?: Record<string, unknown>) {
|
|
18
|
+
return client.get(`/oauth/api/v1/admin/oauth/clients/${clientId}`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function adminOauthClientsByClientsPut(client: ApiClient, data?: Record<string, unknown>) {
|
|
22
|
+
return client.put(`/oauth/api/v1/admin/oauth/clients/${clientId}`, data);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function adminOauthClientsAuditLogsByClients(client: ApiClient, data?: Record<string, unknown>) {
|
|
26
|
+
return client.get(`/oauth/api/v1/admin/oauth/clients/${clientId}/audit-logs`, { params });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function adminOauthClientsCloneByClientsPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
30
|
+
return client.post(`/oauth/api/v1/admin/oauth/clients/${clientId}/clone`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function adminOauthClientsRotateSecretByClientsPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
34
|
+
return client.post(`/oauth/api/v1/admin/oauth/clients/${clientId}/rotate-secret`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function adminOauthClientsSecretsByClients(client: ApiClient, data?: Record<string, unknown>) {
|
|
38
|
+
return client.get(`/oauth/api/v1/admin/oauth/clients/${clientId}/secrets`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function adminOauthClientsSecretsByClientsPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
42
|
+
return client.post(`/oauth/api/v1/admin/oauth/clients/${clientId}/secrets`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function adminOauthClientsSecretsByClientsBySecretsDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
46
|
+
return client.delete(`/oauth/api/v1/admin/oauth/clients/${clientId}/secrets/${secretId}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function adminOauthClientsSecretsDeactivateByClientsBySecretsPut(client: ApiClient, data?: Record<string, unknown>) {
|
|
50
|
+
return client.put(`/oauth/api/v1/admin/oauth/clients/${clientId}/secrets/${secretId}/deactivate`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function adminOauthClientsStatsByClients(client: ApiClient, data?: Record<string, unknown>) {
|
|
54
|
+
return client.get(`/oauth/api/v1/admin/oauth/clients/${clientId}/stats`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function adminOauthClientsTokensByClientsDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
58
|
+
return client.delete(`/oauth/api/v1/admin/oauth/clients/${clientId}/tokens`, { params });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function adminOauthClientsTokensByClients(client: ApiClient, data?: Record<string, unknown>) {
|
|
62
|
+
return client.get(`/oauth/api/v1/admin/oauth/clients/${clientId}/tokens`, { params });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function adminOauthDevices(client: ApiClient, data?: Record<string, unknown>) {
|
|
66
|
+
return client.get(`/oauth/api/v1/admin/oauth/devices`, { params });
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function adminOauthDevicesByDevicesDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
70
|
+
return client.delete(`/oauth/api/v1/admin/oauth/devices/${deviceCode}`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function adminOauthProviders(client: ApiClient, data?: Record<string, unknown>) {
|
|
74
|
+
return client.get(`/oauth/api/v1/admin/oauth/providers`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function adminOauthProvidersPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
78
|
+
return client.post(`/oauth/api/v1/admin/oauth/providers`, data);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function adminOauthProvidersByProvidersDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
82
|
+
return client.delete(`/oauth/api/v1/admin/oauth/providers/${name}`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function adminOauthProvidersByProvidersPut(client: ApiClient, data?: Record<string, unknown>) {
|
|
86
|
+
return client.put(`/oauth/api/v1/admin/oauth/providers/${name}`, data);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function adminOauthProvidersToggleByProvidersPut(client: ApiClient, data?: Record<string, unknown>) {
|
|
90
|
+
return client.put(`/oauth/api/v1/admin/oauth/providers/${name}/toggle`, data);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function adminOauthTokensUserByUserDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
94
|
+
return client.delete(`/oauth/api/v1/admin/oauth/tokens/user/${userId}`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function oauthAuthorize(client: ApiClient, data?: Record<string, unknown>) {
|
|
98
|
+
return client.get(`/oauth/api/v1/oauth/authorize`, { params });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function oauthAuthorizePost(client: ApiClient, data?: Record<string, unknown>) {
|
|
102
|
+
return client.post(`/oauth/api/v1/oauth/authorize`, data);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function oauthBindPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
106
|
+
return client.post(`/oauth/api/v1/oauth/bind`, data);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function oauthClientByClient(client: ApiClient, data?: Record<string, unknown>) {
|
|
110
|
+
return client.get(`/oauth/api/v1/oauth/client/${clientId}`);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function oauthConnectionsByConnections(client: ApiClient, data?: Record<string, unknown>) {
|
|
114
|
+
return client.get(`/oauth/api/v1/oauth/connections/${userId}`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function oauthConsents(client: ApiClient, data?: Record<string, unknown>) {
|
|
118
|
+
return client.get(`/oauth/api/v1/oauth/consents`);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function oauthConsentsByConsentsDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
122
|
+
return client.delete(`/oauth/api/v1/oauth/consents/${id}`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function oauthDeviceAuthorizePost(client: ApiClient, data?: Record<string, unknown>) {
|
|
126
|
+
return client.post(`/oauth/api/v1/oauth/device/authorize`, data);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function oauthDeviceVerifyPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
130
|
+
return client.post(`/oauth/api/v1/oauth/device/verify`, data);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function oauthDpopNonce(client: ApiClient, data?: Record<string, unknown>) {
|
|
134
|
+
return client.get(`/oauth/api/v1/oauth/dpop/nonce`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function oauthIntrospectPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
138
|
+
return client.post(`/oauth/api/v1/oauth/introspect`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function oauthProviders(client: ApiClient, data?: Record<string, unknown>) {
|
|
142
|
+
return client.get(`/oauth/api/v1/oauth/providers`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function oauthPushedAuthorizationPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
146
|
+
return client.post(`/oauth/api/v1/oauth/pushed-authorization`, data);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function oauthRefreshPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
150
|
+
return client.post(`/oauth/api/v1/oauth/refresh`, data);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function oauthRegisterPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
154
|
+
return client.post(`/oauth/api/v1/oauth/register`, data);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function oauthRegisterByRegisterDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
158
|
+
return client.delete(`/oauth/api/v1/oauth/register/${clientId}`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function oauthRegisterByRegister(client: ApiClient, data?: Record<string, unknown>) {
|
|
162
|
+
return client.get(`/oauth/api/v1/oauth/register/${clientId}`);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function oauthRegisterByRegisterPut(client: ApiClient, data?: Record<string, unknown>) {
|
|
166
|
+
return client.put(`/oauth/api/v1/oauth/register/${clientId}`, data);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function oauthRevokePost(client: ApiClient, data?: Record<string, unknown>) {
|
|
170
|
+
return client.post(`/oauth/api/v1/oauth/revoke`, data);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export function oauthRiskAssessment(client: ApiClient, data?: Record<string, unknown>) {
|
|
174
|
+
return client.get(`/oauth/api/v1/oauth/risk-assessment`, { params });
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function oauthTokenPost(client: ApiClient, data?: Record<string, unknown>) {
|
|
178
|
+
return client.post(`/oauth/api/v1/oauth/token`);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export function oauthTokenExchangePost(client: ApiClient, data?: Record<string, unknown>) {
|
|
182
|
+
return client.post(`/oauth/api/v1/oauth/token-exchange`);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export function oauthUnbindByUnbindDelete(client: ApiClient, data?: Record<string, unknown>) {
|
|
186
|
+
return client.delete(`/oauth/api/v1/oauth/unbind/${connectionId}`);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function oauthUserinfo(client: ApiClient, data?: Record<string, unknown>) {
|
|
190
|
+
return client.get(`/oauth/api/v1/oauth/userinfo`);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function oauthAuthorizeByOauth(client: ApiClient, data?: Record<string, unknown>) {
|
|
194
|
+
return client.get(`/oauth/api/v1/oauth/${provider}/authorize`, { params });
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function oauthCallbackByOauth(client: ApiClient, data?: Record<string, unknown>) {
|
|
198
|
+
return client.get(`/oauth/api/v1/oauth/${provider}/callback`, { params });
|
|
199
|
+
}
|
|
200
|
+
|