@sso-id/node 0.2.0 → 0.2.2
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/dist/management.js +14 -2
- package/package.json +1 -1
package/dist/management.js
CHANGED
|
@@ -17,6 +17,7 @@ export class ManagementClient {
|
|
|
17
17
|
grant_type: 'client_credentials',
|
|
18
18
|
client_id: this.options.clientId,
|
|
19
19
|
client_secret: this.options.clientSecret,
|
|
20
|
+
redirect_uri: this.options.audience || this.authBaseUrl,
|
|
20
21
|
...(this.options.audience ? { audience: this.options.audience } : {}),
|
|
21
22
|
});
|
|
22
23
|
const res = await fetch(`${this.authBaseUrl}/auth/oauth/token`, {
|
|
@@ -67,7 +68,12 @@ export class ManagementClient {
|
|
|
67
68
|
return this.request('GET', `/api/users${qs ? `?${qs}` : ''}`);
|
|
68
69
|
},
|
|
69
70
|
get: (userId) => this.request('GET', `/api/users/${encodeURIComponent(userId)}`),
|
|
70
|
-
create: (data) => this.request('POST', '/api/users',
|
|
71
|
+
create: (data) => this.request('POST', '/api/users', {
|
|
72
|
+
emailAddress: data.emailAddress ?? data.email ?? data.userName,
|
|
73
|
+
firstName: data.firstName ?? data.name ?? data.displayName ?? 'User',
|
|
74
|
+
lastName: data.lastName ?? 'User',
|
|
75
|
+
...data,
|
|
76
|
+
}),
|
|
71
77
|
invite: (data) => this.request('POST', '/api/users/invite', data),
|
|
72
78
|
update: (userId, data) => this.request('PUT', `/api/users/${encodeURIComponent(userId)}`, data),
|
|
73
79
|
delete: (userId) => this.request('DELETE', `/api/users/${encodeURIComponent(userId)}`),
|
|
@@ -110,7 +116,13 @@ export class ManagementClient {
|
|
|
110
116
|
groups = {
|
|
111
117
|
list: () => this.request('GET', '/api/groups'),
|
|
112
118
|
get: (groupId) => this.request('GET', `/api/groups/${encodeURIComponent(groupId)}`),
|
|
113
|
-
create: (data) => this.request('POST', '/api/groups',
|
|
119
|
+
create: (data) => this.request('POST', '/api/groups', {
|
|
120
|
+
groupId: '',
|
|
121
|
+
groupName: data.groupName ?? data.name,
|
|
122
|
+
createdBy: 'system',
|
|
123
|
+
lastModifiedBy: 'system',
|
|
124
|
+
...data,
|
|
125
|
+
}),
|
|
114
126
|
update: (groupId, data) => this.request('PUT', `/api/groups/${encodeURIComponent(groupId)}`, data),
|
|
115
127
|
delete: (groupId) => this.request('DELETE', `/api/groups/${encodeURIComponent(groupId)}`),
|
|
116
128
|
listUsers: (groupId) => this.request('GET', `/api/groups/${encodeURIComponent(groupId)}/users`),
|
package/package.json
CHANGED