@bagelink/auth 1.7.96 → 1.7.98
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/index.cjs +28 -28
- package/dist/index.mjs +28 -28
- package/package.json +1 -1
- package/src/api.ts +28 -28
package/dist/index.cjs
CHANGED
|
@@ -101,13 +101,13 @@ class AuthApi {
|
|
|
101
101
|
* Get available authentication methods
|
|
102
102
|
*/
|
|
103
103
|
async getAuthMethods() {
|
|
104
|
-
return this.api.get("
|
|
104
|
+
return this.api.get("authentication/methods");
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* Register a new account
|
|
108
108
|
*/
|
|
109
109
|
async register(data) {
|
|
110
|
-
return this.api.post("
|
|
110
|
+
return this.api.post("authentication/register", {
|
|
111
111
|
...data,
|
|
112
112
|
email: data.email.toLowerCase()
|
|
113
113
|
});
|
|
@@ -116,7 +116,7 @@ class AuthApi {
|
|
|
116
116
|
* Login with password
|
|
117
117
|
*/
|
|
118
118
|
async login(email, password) {
|
|
119
|
-
return this.api.post("
|
|
119
|
+
return this.api.post("authentication/login/password", {
|
|
120
120
|
email: email.toLowerCase(),
|
|
121
121
|
password
|
|
122
122
|
});
|
|
@@ -125,13 +125,13 @@ class AuthApi {
|
|
|
125
125
|
* Logout and clear session
|
|
126
126
|
*/
|
|
127
127
|
async logout() {
|
|
128
|
-
return this.api.post("
|
|
128
|
+
return this.api.post("authentication/logout", {});
|
|
129
129
|
}
|
|
130
130
|
/**
|
|
131
131
|
* Refresh current session
|
|
132
132
|
*/
|
|
133
133
|
async refreshSession() {
|
|
134
|
-
return this.api.post("
|
|
134
|
+
return this.api.post("authentication/refresh", {});
|
|
135
135
|
}
|
|
136
136
|
// ============================================
|
|
137
137
|
// SSO Authentication Methods
|
|
@@ -141,7 +141,7 @@ class AuthApi {
|
|
|
141
141
|
* Returns authorization URL to redirect user to
|
|
142
142
|
*/
|
|
143
143
|
async initiateSSO(data) {
|
|
144
|
-
return this.api.post(
|
|
144
|
+
return this.api.post(`authentication/sso/${data.provider}/initiate`, {
|
|
145
145
|
redirect_uri: data.redirect_uri,
|
|
146
146
|
state: data.state
|
|
147
147
|
});
|
|
@@ -150,7 +150,7 @@ class AuthApi {
|
|
|
150
150
|
* Complete SSO login after callback from provider
|
|
151
151
|
*/
|
|
152
152
|
async ssoCallback(data) {
|
|
153
|
-
return this.api.post(
|
|
153
|
+
return this.api.post(`authentication/sso/${data.provider}/callback`, {
|
|
154
154
|
code: data.code,
|
|
155
155
|
state: data.state
|
|
156
156
|
});
|
|
@@ -159,7 +159,7 @@ class AuthApi {
|
|
|
159
159
|
* Link an SSO provider to existing account
|
|
160
160
|
*/
|
|
161
161
|
async linkSSOProvider(data) {
|
|
162
|
-
return this.api.post(
|
|
162
|
+
return this.api.post(`authentication/sso/${data.provider}/link`, {
|
|
163
163
|
code: data.code,
|
|
164
164
|
state: data.state
|
|
165
165
|
});
|
|
@@ -168,7 +168,7 @@ class AuthApi {
|
|
|
168
168
|
* Unlink an SSO provider from account
|
|
169
169
|
*/
|
|
170
170
|
async unlinkSSOProvider(provider) {
|
|
171
|
-
return this.api.delete(
|
|
171
|
+
return this.api.delete(`authentication/sso/${provider}/unlink`);
|
|
172
172
|
}
|
|
173
173
|
// ============================================
|
|
174
174
|
// Current User (Me) Methods
|
|
@@ -177,19 +177,19 @@ class AuthApi {
|
|
|
177
177
|
* Get current user account info
|
|
178
178
|
*/
|
|
179
179
|
async getCurrentUser() {
|
|
180
|
-
return this.api.get("
|
|
180
|
+
return this.api.get("authentication/me");
|
|
181
181
|
}
|
|
182
182
|
/**
|
|
183
183
|
* Update current user profile
|
|
184
184
|
*/
|
|
185
185
|
async updateCurrentUser(data) {
|
|
186
|
-
return this.api.patch("
|
|
186
|
+
return this.api.patch("authentication/me", data);
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* Delete current user account
|
|
190
190
|
*/
|
|
191
191
|
async deleteCurrentUser() {
|
|
192
|
-
return this.api.delete("
|
|
192
|
+
return this.api.delete("authentication/me");
|
|
193
193
|
}
|
|
194
194
|
// ============================================
|
|
195
195
|
// Account Management (Admin)
|
|
@@ -198,31 +198,31 @@ class AuthApi {
|
|
|
198
198
|
* Get account information by ID
|
|
199
199
|
*/
|
|
200
200
|
async getAccount(accountId) {
|
|
201
|
-
return this.api.get(
|
|
201
|
+
return this.api.get(`authentication/account/${accountId}`);
|
|
202
202
|
}
|
|
203
203
|
/**
|
|
204
204
|
* Update account by ID
|
|
205
205
|
*/
|
|
206
206
|
async updateAccount(accountId, data) {
|
|
207
|
-
return this.api.patch(
|
|
207
|
+
return this.api.patch(`authentication/account/${accountId}`, data);
|
|
208
208
|
}
|
|
209
209
|
/**
|
|
210
210
|
* Delete account by ID
|
|
211
211
|
*/
|
|
212
212
|
async deleteAccount(accountId) {
|
|
213
|
-
return this.api.delete(
|
|
213
|
+
return this.api.delete(`authentication/account/${accountId}`);
|
|
214
214
|
}
|
|
215
215
|
/**
|
|
216
216
|
* Activate account by ID
|
|
217
217
|
*/
|
|
218
218
|
async activateAccount(accountId) {
|
|
219
|
-
return this.api.post(
|
|
219
|
+
return this.api.post(`authentication/account/${accountId}/activate`, {});
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
222
222
|
* Deactivate account by ID
|
|
223
223
|
*/
|
|
224
224
|
async deactivateAccount(accountId) {
|
|
225
|
-
return this.api.post(
|
|
225
|
+
return this.api.post(`authentication/account/${accountId}/deactivate`, {});
|
|
226
226
|
}
|
|
227
227
|
// ============================================
|
|
228
228
|
// Password Management
|
|
@@ -231,13 +231,13 @@ class AuthApi {
|
|
|
231
231
|
* Change password (requires current password)
|
|
232
232
|
*/
|
|
233
233
|
async changePassword(data) {
|
|
234
|
-
return this.api.post("
|
|
234
|
+
return this.api.post("authentication/password/change", data);
|
|
235
235
|
}
|
|
236
236
|
/**
|
|
237
237
|
* Initiate forgot password flow
|
|
238
238
|
*/
|
|
239
239
|
async forgotPassword(email) {
|
|
240
|
-
return this.api.post("
|
|
240
|
+
return this.api.post("authentication/password/forgot", {
|
|
241
241
|
email: email.toLowerCase()
|
|
242
242
|
});
|
|
243
243
|
}
|
|
@@ -245,13 +245,13 @@ class AuthApi {
|
|
|
245
245
|
* Verify password reset token
|
|
246
246
|
*/
|
|
247
247
|
async verifyResetToken(token) {
|
|
248
|
-
return this.api.get(
|
|
248
|
+
return this.api.get(`authentication/password/verify-reset-token/${token}`);
|
|
249
249
|
}
|
|
250
250
|
/**
|
|
251
251
|
* Reset password with token
|
|
252
252
|
*/
|
|
253
253
|
async resetPassword(data) {
|
|
254
|
-
return this.api.post("
|
|
254
|
+
return this.api.post("authentication/password/reset", data);
|
|
255
255
|
}
|
|
256
256
|
// ============================================
|
|
257
257
|
// Email Verification
|
|
@@ -260,7 +260,7 @@ class AuthApi {
|
|
|
260
260
|
* Send email verification
|
|
261
261
|
*/
|
|
262
262
|
async sendVerification(data = {}, user) {
|
|
263
|
-
return this.api.post("
|
|
263
|
+
return this.api.post("authentication/verify/send", data, {
|
|
264
264
|
params: user ? { user } : void 0
|
|
265
265
|
});
|
|
266
266
|
}
|
|
@@ -268,7 +268,7 @@ class AuthApi {
|
|
|
268
268
|
* Verify email with token
|
|
269
269
|
*/
|
|
270
270
|
async verifyEmail(token) {
|
|
271
|
-
return this.api.post("
|
|
271
|
+
return this.api.post("authentication/verify/email", { token });
|
|
272
272
|
}
|
|
273
273
|
// ============================================
|
|
274
274
|
// Session Management
|
|
@@ -277,25 +277,25 @@ class AuthApi {
|
|
|
277
277
|
* Get sessions for an account
|
|
278
278
|
*/
|
|
279
279
|
async getSessions(accountId) {
|
|
280
|
-
return this.api.get(
|
|
280
|
+
return this.api.get(`authentication/sessions/${accountId}`);
|
|
281
281
|
}
|
|
282
282
|
/**
|
|
283
283
|
* Revoke a specific session
|
|
284
284
|
*/
|
|
285
285
|
async revokeSession(sessionToken) {
|
|
286
|
-
return this.api.delete(
|
|
286
|
+
return this.api.delete(`authentication/sessions/${sessionToken}`);
|
|
287
287
|
}
|
|
288
288
|
/**
|
|
289
289
|
* Revoke all sessions for an account
|
|
290
290
|
*/
|
|
291
291
|
async revokeAllSessions(accountId) {
|
|
292
|
-
return this.api.delete(
|
|
292
|
+
return this.api.delete(`authentication/sessions/account/${accountId}`);
|
|
293
293
|
}
|
|
294
294
|
/**
|
|
295
295
|
* Cleanup expired sessions (admin)
|
|
296
296
|
*/
|
|
297
297
|
async cleanupSessions() {
|
|
298
|
-
return this.api.post("
|
|
298
|
+
return this.api.post("authentication/cleanup-sessions", {});
|
|
299
299
|
}
|
|
300
300
|
// ============================================
|
|
301
301
|
// Multi-Tenancy Methods
|
|
@@ -304,7 +304,7 @@ class AuthApi {
|
|
|
304
304
|
* Get list of tenants the authenticated user belongs to
|
|
305
305
|
*/
|
|
306
306
|
async getTenants() {
|
|
307
|
-
return this.api.get("
|
|
307
|
+
return this.api.get("tenants");
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
const _hoisted_1$8 = { class: "txt20 bold mb-1" };
|
package/dist/index.mjs
CHANGED
|
@@ -99,13 +99,13 @@ class AuthApi {
|
|
|
99
99
|
* Get available authentication methods
|
|
100
100
|
*/
|
|
101
101
|
async getAuthMethods() {
|
|
102
|
-
return this.api.get("
|
|
102
|
+
return this.api.get("authentication/methods");
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
105
|
* Register a new account
|
|
106
106
|
*/
|
|
107
107
|
async register(data) {
|
|
108
|
-
return this.api.post("
|
|
108
|
+
return this.api.post("authentication/register", {
|
|
109
109
|
...data,
|
|
110
110
|
email: data.email.toLowerCase()
|
|
111
111
|
});
|
|
@@ -114,7 +114,7 @@ class AuthApi {
|
|
|
114
114
|
* Login with password
|
|
115
115
|
*/
|
|
116
116
|
async login(email, password) {
|
|
117
|
-
return this.api.post("
|
|
117
|
+
return this.api.post("authentication/login/password", {
|
|
118
118
|
email: email.toLowerCase(),
|
|
119
119
|
password
|
|
120
120
|
});
|
|
@@ -123,13 +123,13 @@ class AuthApi {
|
|
|
123
123
|
* Logout and clear session
|
|
124
124
|
*/
|
|
125
125
|
async logout() {
|
|
126
|
-
return this.api.post("
|
|
126
|
+
return this.api.post("authentication/logout", {});
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
129
129
|
* Refresh current session
|
|
130
130
|
*/
|
|
131
131
|
async refreshSession() {
|
|
132
|
-
return this.api.post("
|
|
132
|
+
return this.api.post("authentication/refresh", {});
|
|
133
133
|
}
|
|
134
134
|
// ============================================
|
|
135
135
|
// SSO Authentication Methods
|
|
@@ -139,7 +139,7 @@ class AuthApi {
|
|
|
139
139
|
* Returns authorization URL to redirect user to
|
|
140
140
|
*/
|
|
141
141
|
async initiateSSO(data) {
|
|
142
|
-
return this.api.post(
|
|
142
|
+
return this.api.post(`authentication/sso/${data.provider}/initiate`, {
|
|
143
143
|
redirect_uri: data.redirect_uri,
|
|
144
144
|
state: data.state
|
|
145
145
|
});
|
|
@@ -148,7 +148,7 @@ class AuthApi {
|
|
|
148
148
|
* Complete SSO login after callback from provider
|
|
149
149
|
*/
|
|
150
150
|
async ssoCallback(data) {
|
|
151
|
-
return this.api.post(
|
|
151
|
+
return this.api.post(`authentication/sso/${data.provider}/callback`, {
|
|
152
152
|
code: data.code,
|
|
153
153
|
state: data.state
|
|
154
154
|
});
|
|
@@ -157,7 +157,7 @@ class AuthApi {
|
|
|
157
157
|
* Link an SSO provider to existing account
|
|
158
158
|
*/
|
|
159
159
|
async linkSSOProvider(data) {
|
|
160
|
-
return this.api.post(
|
|
160
|
+
return this.api.post(`authentication/sso/${data.provider}/link`, {
|
|
161
161
|
code: data.code,
|
|
162
162
|
state: data.state
|
|
163
163
|
});
|
|
@@ -166,7 +166,7 @@ class AuthApi {
|
|
|
166
166
|
* Unlink an SSO provider from account
|
|
167
167
|
*/
|
|
168
168
|
async unlinkSSOProvider(provider) {
|
|
169
|
-
return this.api.delete(
|
|
169
|
+
return this.api.delete(`authentication/sso/${provider}/unlink`);
|
|
170
170
|
}
|
|
171
171
|
// ============================================
|
|
172
172
|
// Current User (Me) Methods
|
|
@@ -175,19 +175,19 @@ class AuthApi {
|
|
|
175
175
|
* Get current user account info
|
|
176
176
|
*/
|
|
177
177
|
async getCurrentUser() {
|
|
178
|
-
return this.api.get("
|
|
178
|
+
return this.api.get("authentication/me");
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Update current user profile
|
|
182
182
|
*/
|
|
183
183
|
async updateCurrentUser(data) {
|
|
184
|
-
return this.api.patch("
|
|
184
|
+
return this.api.patch("authentication/me", data);
|
|
185
185
|
}
|
|
186
186
|
/**
|
|
187
187
|
* Delete current user account
|
|
188
188
|
*/
|
|
189
189
|
async deleteCurrentUser() {
|
|
190
|
-
return this.api.delete("
|
|
190
|
+
return this.api.delete("authentication/me");
|
|
191
191
|
}
|
|
192
192
|
// ============================================
|
|
193
193
|
// Account Management (Admin)
|
|
@@ -196,31 +196,31 @@ class AuthApi {
|
|
|
196
196
|
* Get account information by ID
|
|
197
197
|
*/
|
|
198
198
|
async getAccount(accountId) {
|
|
199
|
-
return this.api.get(
|
|
199
|
+
return this.api.get(`authentication/account/${accountId}`);
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
202
|
* Update account by ID
|
|
203
203
|
*/
|
|
204
204
|
async updateAccount(accountId, data) {
|
|
205
|
-
return this.api.patch(
|
|
205
|
+
return this.api.patch(`authentication/account/${accountId}`, data);
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
208
208
|
* Delete account by ID
|
|
209
209
|
*/
|
|
210
210
|
async deleteAccount(accountId) {
|
|
211
|
-
return this.api.delete(
|
|
211
|
+
return this.api.delete(`authentication/account/${accountId}`);
|
|
212
212
|
}
|
|
213
213
|
/**
|
|
214
214
|
* Activate account by ID
|
|
215
215
|
*/
|
|
216
216
|
async activateAccount(accountId) {
|
|
217
|
-
return this.api.post(
|
|
217
|
+
return this.api.post(`authentication/account/${accountId}/activate`, {});
|
|
218
218
|
}
|
|
219
219
|
/**
|
|
220
220
|
* Deactivate account by ID
|
|
221
221
|
*/
|
|
222
222
|
async deactivateAccount(accountId) {
|
|
223
|
-
return this.api.post(
|
|
223
|
+
return this.api.post(`authentication/account/${accountId}/deactivate`, {});
|
|
224
224
|
}
|
|
225
225
|
// ============================================
|
|
226
226
|
// Password Management
|
|
@@ -229,13 +229,13 @@ class AuthApi {
|
|
|
229
229
|
* Change password (requires current password)
|
|
230
230
|
*/
|
|
231
231
|
async changePassword(data) {
|
|
232
|
-
return this.api.post("
|
|
232
|
+
return this.api.post("authentication/password/change", data);
|
|
233
233
|
}
|
|
234
234
|
/**
|
|
235
235
|
* Initiate forgot password flow
|
|
236
236
|
*/
|
|
237
237
|
async forgotPassword(email) {
|
|
238
|
-
return this.api.post("
|
|
238
|
+
return this.api.post("authentication/password/forgot", {
|
|
239
239
|
email: email.toLowerCase()
|
|
240
240
|
});
|
|
241
241
|
}
|
|
@@ -243,13 +243,13 @@ class AuthApi {
|
|
|
243
243
|
* Verify password reset token
|
|
244
244
|
*/
|
|
245
245
|
async verifyResetToken(token) {
|
|
246
|
-
return this.api.get(
|
|
246
|
+
return this.api.get(`authentication/password/verify-reset-token/${token}`);
|
|
247
247
|
}
|
|
248
248
|
/**
|
|
249
249
|
* Reset password with token
|
|
250
250
|
*/
|
|
251
251
|
async resetPassword(data) {
|
|
252
|
-
return this.api.post("
|
|
252
|
+
return this.api.post("authentication/password/reset", data);
|
|
253
253
|
}
|
|
254
254
|
// ============================================
|
|
255
255
|
// Email Verification
|
|
@@ -258,7 +258,7 @@ class AuthApi {
|
|
|
258
258
|
* Send email verification
|
|
259
259
|
*/
|
|
260
260
|
async sendVerification(data = {}, user) {
|
|
261
|
-
return this.api.post("
|
|
261
|
+
return this.api.post("authentication/verify/send", data, {
|
|
262
262
|
params: user ? { user } : void 0
|
|
263
263
|
});
|
|
264
264
|
}
|
|
@@ -266,7 +266,7 @@ class AuthApi {
|
|
|
266
266
|
* Verify email with token
|
|
267
267
|
*/
|
|
268
268
|
async verifyEmail(token) {
|
|
269
|
-
return this.api.post("
|
|
269
|
+
return this.api.post("authentication/verify/email", { token });
|
|
270
270
|
}
|
|
271
271
|
// ============================================
|
|
272
272
|
// Session Management
|
|
@@ -275,25 +275,25 @@ class AuthApi {
|
|
|
275
275
|
* Get sessions for an account
|
|
276
276
|
*/
|
|
277
277
|
async getSessions(accountId) {
|
|
278
|
-
return this.api.get(
|
|
278
|
+
return this.api.get(`authentication/sessions/${accountId}`);
|
|
279
279
|
}
|
|
280
280
|
/**
|
|
281
281
|
* Revoke a specific session
|
|
282
282
|
*/
|
|
283
283
|
async revokeSession(sessionToken) {
|
|
284
|
-
return this.api.delete(
|
|
284
|
+
return this.api.delete(`authentication/sessions/${sessionToken}`);
|
|
285
285
|
}
|
|
286
286
|
/**
|
|
287
287
|
* Revoke all sessions for an account
|
|
288
288
|
*/
|
|
289
289
|
async revokeAllSessions(accountId) {
|
|
290
|
-
return this.api.delete(
|
|
290
|
+
return this.api.delete(`authentication/sessions/account/${accountId}`);
|
|
291
291
|
}
|
|
292
292
|
/**
|
|
293
293
|
* Cleanup expired sessions (admin)
|
|
294
294
|
*/
|
|
295
295
|
async cleanupSessions() {
|
|
296
|
-
return this.api.post("
|
|
296
|
+
return this.api.post("authentication/cleanup-sessions", {});
|
|
297
297
|
}
|
|
298
298
|
// ============================================
|
|
299
299
|
// Multi-Tenancy Methods
|
|
@@ -302,7 +302,7 @@ class AuthApi {
|
|
|
302
302
|
* Get list of tenants the authenticated user belongs to
|
|
303
303
|
*/
|
|
304
304
|
async getTenants() {
|
|
305
|
-
return this.api.get("
|
|
305
|
+
return this.api.get("tenants");
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
const _hoisted_1$8 = { class: "txt20 bold mb-1" };
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -90,14 +90,14 @@ export class AuthApi {
|
|
|
90
90
|
* Get available authentication methods
|
|
91
91
|
*/
|
|
92
92
|
async getAuthMethods(): Promise<GetMethodsResponse> {
|
|
93
|
-
return this.api.get('
|
|
93
|
+
return this.api.get('authentication/methods')
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
97
|
* Register a new account
|
|
98
98
|
*/
|
|
99
99
|
async register(data: RegisterRequest): Promise<RegisterResponse> {
|
|
100
|
-
return this.api.post('
|
|
100
|
+
return this.api.post('authentication/register', {
|
|
101
101
|
...data,
|
|
102
102
|
email: data.email.toLowerCase(),
|
|
103
103
|
})
|
|
@@ -107,7 +107,7 @@ export class AuthApi {
|
|
|
107
107
|
* Login with password
|
|
108
108
|
*/
|
|
109
109
|
async login(email: string, password: string): Promise<LoginResponse> {
|
|
110
|
-
return this.api.post('
|
|
110
|
+
return this.api.post('authentication/login/password', {
|
|
111
111
|
email: email.toLowerCase(),
|
|
112
112
|
password,
|
|
113
113
|
})
|
|
@@ -117,14 +117,14 @@ export class AuthApi {
|
|
|
117
117
|
* Logout and clear session
|
|
118
118
|
*/
|
|
119
119
|
async logout(): Promise<LogoutResponse> {
|
|
120
|
-
return this.api.post('
|
|
120
|
+
return this.api.post('authentication/logout', {})
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* Refresh current session
|
|
125
125
|
*/
|
|
126
126
|
async refreshSession(): Promise<RefreshSessionResponse> {
|
|
127
|
-
return this.api.post('
|
|
127
|
+
return this.api.post('authentication/refresh', {})
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
// ============================================
|
|
@@ -136,7 +136,7 @@ export class AuthApi {
|
|
|
136
136
|
* Returns authorization URL to redirect user to
|
|
137
137
|
*/
|
|
138
138
|
async initiateSSO(data: SSOInitiateRequest): Promise<SSOInitiateResponse> {
|
|
139
|
-
return this.api.post(
|
|
139
|
+
return this.api.post(`authentication/sso/${data.provider}/initiate`, {
|
|
140
140
|
redirect_uri: data.redirect_uri,
|
|
141
141
|
state: data.state,
|
|
142
142
|
})
|
|
@@ -146,7 +146,7 @@ export class AuthApi {
|
|
|
146
146
|
* Complete SSO login after callback from provider
|
|
147
147
|
*/
|
|
148
148
|
async ssoCallback(data: SSOCallbackRequest): Promise<SSOCallbackResponse> {
|
|
149
|
-
return this.api.post(
|
|
149
|
+
return this.api.post(`authentication/sso/${data.provider}/callback`, {
|
|
150
150
|
code: data.code,
|
|
151
151
|
state: data.state,
|
|
152
152
|
})
|
|
@@ -156,7 +156,7 @@ export class AuthApi {
|
|
|
156
156
|
* Link an SSO provider to existing account
|
|
157
157
|
*/
|
|
158
158
|
async linkSSOProvider(data: SSOLinkRequest): Promise<SSOLinkResponse> {
|
|
159
|
-
return this.api.post(
|
|
159
|
+
return this.api.post(`authentication/sso/${data.provider}/link`, {
|
|
160
160
|
code: data.code,
|
|
161
161
|
state: data.state,
|
|
162
162
|
})
|
|
@@ -166,7 +166,7 @@ export class AuthApi {
|
|
|
166
166
|
* Unlink an SSO provider from account
|
|
167
167
|
*/
|
|
168
168
|
async unlinkSSOProvider(provider: SSOProvider): Promise<SSOUnlinkResponse> {
|
|
169
|
-
return this.api.delete(
|
|
169
|
+
return this.api.delete(`authentication/sso/${provider}/unlink`)
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
// ============================================
|
|
@@ -177,21 +177,21 @@ export class AuthApi {
|
|
|
177
177
|
* Get current user account info
|
|
178
178
|
*/
|
|
179
179
|
async getCurrentUser(): Promise<GetMeResponse> {
|
|
180
|
-
return this.api.get('
|
|
180
|
+
return this.api.get('authentication/me')
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
184
|
* Update current user profile
|
|
185
185
|
*/
|
|
186
186
|
async updateCurrentUser(data: UpdateAccountRequest): Promise<UpdateMeResponse> {
|
|
187
|
-
return this.api.patch('
|
|
187
|
+
return this.api.patch('authentication/me', data)
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
191
|
* Delete current user account
|
|
192
192
|
*/
|
|
193
193
|
async deleteCurrentUser(): Promise<DeleteMeResponse> {
|
|
194
|
-
return this.api.delete('
|
|
194
|
+
return this.api.delete('authentication/me')
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
// ============================================
|
|
@@ -202,7 +202,7 @@ export class AuthApi {
|
|
|
202
202
|
* Get account information by ID
|
|
203
203
|
*/
|
|
204
204
|
async getAccount(accountId: string): Promise<GetAccountResponse> {
|
|
205
|
-
return this.api.get(
|
|
205
|
+
return this.api.get(`authentication/account/${accountId}`)
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
/**
|
|
@@ -212,21 +212,21 @@ export class AuthApi {
|
|
|
212
212
|
accountId: string,
|
|
213
213
|
data: UpdateAccountRequest
|
|
214
214
|
): Promise<UpdateAccountResponse> {
|
|
215
|
-
return this.api.patch(
|
|
215
|
+
return this.api.patch(`authentication/account/${accountId}`, data)
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
/**
|
|
219
219
|
* Delete account by ID
|
|
220
220
|
*/
|
|
221
221
|
async deleteAccount(accountId: string): Promise<DeleteAccountResponse> {
|
|
222
|
-
return this.api.delete(
|
|
222
|
+
return this.api.delete(`authentication/account/${accountId}`)
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
226
|
* Activate account by ID
|
|
227
227
|
*/
|
|
228
228
|
async activateAccount(accountId: string): Promise<ActivateAccountResponse> {
|
|
229
|
-
return this.api.post(
|
|
229
|
+
return this.api.post(`authentication/account/${accountId}/activate`, {})
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
/**
|
|
@@ -235,7 +235,7 @@ export class AuthApi {
|
|
|
235
235
|
async deactivateAccount(
|
|
236
236
|
accountId: string
|
|
237
237
|
): Promise<DeactivateAccountResponse> {
|
|
238
|
-
return this.api.post(
|
|
238
|
+
return this.api.post(`authentication/account/${accountId}/deactivate`, {})
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
// ============================================
|
|
@@ -246,14 +246,14 @@ export class AuthApi {
|
|
|
246
246
|
* Change password (requires current password)
|
|
247
247
|
*/
|
|
248
248
|
async changePassword(data: ChangePasswordRequest): Promise<ChangePasswordResponse> {
|
|
249
|
-
return this.api.post('
|
|
249
|
+
return this.api.post('authentication/password/change', data)
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
/**
|
|
253
253
|
* Initiate forgot password flow
|
|
254
254
|
*/
|
|
255
255
|
async forgotPassword(email: string): Promise<ForgotPasswordResponse> {
|
|
256
|
-
return this.api.post('
|
|
256
|
+
return this.api.post('authentication/password/forgot', {
|
|
257
257
|
email: email.toLowerCase(),
|
|
258
258
|
})
|
|
259
259
|
}
|
|
@@ -262,14 +262,14 @@ export class AuthApi {
|
|
|
262
262
|
* Verify password reset token
|
|
263
263
|
*/
|
|
264
264
|
async verifyResetToken(token: string): Promise<VerifyResetTokenResponse> {
|
|
265
|
-
return this.api.get(
|
|
265
|
+
return this.api.get(`authentication/password/verify-reset-token/${token}`)
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
/**
|
|
269
269
|
* Reset password with token
|
|
270
270
|
*/
|
|
271
271
|
async resetPassword(data: ResetPasswordRequest): Promise<ResetPasswordResponse> {
|
|
272
|
-
return this.api.post('
|
|
272
|
+
return this.api.post('authentication/password/reset', data)
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
// ============================================
|
|
@@ -283,7 +283,7 @@ export class AuthApi {
|
|
|
283
283
|
data: SendVerificationRequest = {},
|
|
284
284
|
user?: AuthenticationAccount
|
|
285
285
|
): Promise<SendVerificationResponse> {
|
|
286
|
-
return this.api.post('
|
|
286
|
+
return this.api.post('authentication/verify/send', data, {
|
|
287
287
|
params: user ? { user } : undefined,
|
|
288
288
|
})
|
|
289
289
|
}
|
|
@@ -292,7 +292,7 @@ export class AuthApi {
|
|
|
292
292
|
* Verify email with token
|
|
293
293
|
*/
|
|
294
294
|
async verifyEmail(token: string): Promise<VerifyEmailResponse> {
|
|
295
|
-
return this.api.post('
|
|
295
|
+
return this.api.post('authentication/verify/email', { token })
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
// ============================================
|
|
@@ -303,28 +303,28 @@ export class AuthApi {
|
|
|
303
303
|
* Get sessions for an account
|
|
304
304
|
*/
|
|
305
305
|
async getSessions(accountId: string): Promise<GetSessionsResponse> {
|
|
306
|
-
return this.api.get(
|
|
306
|
+
return this.api.get(`authentication/sessions/${accountId}`)
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
/**
|
|
310
310
|
* Revoke a specific session
|
|
311
311
|
*/
|
|
312
312
|
async revokeSession(sessionToken: string): Promise<DeleteSessionResponse> {
|
|
313
|
-
return this.api.delete(
|
|
313
|
+
return this.api.delete(`authentication/sessions/${sessionToken}`)
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
/**
|
|
317
317
|
* Revoke all sessions for an account
|
|
318
318
|
*/
|
|
319
319
|
async revokeAllSessions(accountId: string): Promise<DeleteAllSessionsResponse> {
|
|
320
|
-
return this.api.delete(
|
|
320
|
+
return this.api.delete(`authentication/sessions/account/${accountId}`)
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
/**
|
|
324
324
|
* Cleanup expired sessions (admin)
|
|
325
325
|
*/
|
|
326
326
|
async cleanupSessions(): Promise<CleanupSessionsResponse> {
|
|
327
|
-
return this.api.post('
|
|
327
|
+
return this.api.post('authentication/cleanup-sessions', {})
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
// ============================================
|
|
@@ -335,6 +335,6 @@ export class AuthApi {
|
|
|
335
335
|
* Get list of tenants the authenticated user belongs to
|
|
336
336
|
*/
|
|
337
337
|
async getTenants(): Promise<GetTenantsResponse> {
|
|
338
|
-
return this.api.get('
|
|
338
|
+
return this.api.get('tenants')
|
|
339
339
|
}
|
|
340
340
|
}
|