@passkeyme/auth 1.3.0 → 2.0.1
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.esm.js +11 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +11 -11
- package/dist/index.umd.js.map +1 -1
- package/dist/src/api-client.d.ts +1 -1
- package/dist/src/api-client.d.ts.map +1 -1
- package/dist/test/setup.d.ts +0 -1
- package/dist/test/setup.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -265,7 +265,7 @@
|
|
|
265
265
|
* API Client for Passkeyme authentication services
|
|
266
266
|
*/
|
|
267
267
|
class PasskeymeApiClient {
|
|
268
|
-
constructor(appId, baseUrl
|
|
268
|
+
constructor(appId, baseUrl, debug = false) {
|
|
269
269
|
this.appId = appId;
|
|
270
270
|
this.baseUrl = baseUrl.replace(/\/$/, ""); // Remove trailing slash
|
|
271
271
|
this.debug = debug;
|
|
@@ -325,7 +325,7 @@
|
|
|
325
325
|
* Get authentication configuration for the app
|
|
326
326
|
*/
|
|
327
327
|
async getConfig() {
|
|
328
|
-
const backendConfig = await this.request(`/api/${this.appId}/config`);
|
|
328
|
+
const backendConfig = await this.request(`/api/auth/${this.appId}/config`);
|
|
329
329
|
// Map backend response to SDK format
|
|
330
330
|
return {
|
|
331
331
|
appId: backendConfig.app_id,
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
*/
|
|
349
349
|
async startOAuth(provider, redirectUri) {
|
|
350
350
|
const params = new URLSearchParams({ redirect_uri: redirectUri });
|
|
351
|
-
const url = `${this.baseUrl}/auth/${this.appId}/oauth/${provider}/start?${params}`;
|
|
351
|
+
const url = `${this.baseUrl}/api/auth/${this.appId}/oauth/${provider}/start?${params}`;
|
|
352
352
|
this.log("OAuth start URL:", url);
|
|
353
353
|
return url;
|
|
354
354
|
}
|
|
@@ -356,7 +356,7 @@
|
|
|
356
356
|
* Start passkey authentication
|
|
357
357
|
*/
|
|
358
358
|
async startPasskeyAuth(username) {
|
|
359
|
-
return this.request(`/auth/${this.appId}/passkey/start`, {
|
|
359
|
+
return this.request(`/api/auth/${this.appId}/passkey/start`, {
|
|
360
360
|
method: "POST",
|
|
361
361
|
body: JSON.stringify({ username }),
|
|
362
362
|
});
|
|
@@ -365,7 +365,7 @@
|
|
|
365
365
|
* Complete passkey authentication
|
|
366
366
|
*/
|
|
367
367
|
async completePasskeyAuth(credential, redirectUri) {
|
|
368
|
-
return this.request(`/auth/${this.appId}/passkey/complete`, {
|
|
368
|
+
return this.request(`/api/auth/${this.appId}/passkey/complete`, {
|
|
369
369
|
method: "POST",
|
|
370
370
|
body: JSON.stringify({ credential, redirect_uri: redirectUri }),
|
|
371
371
|
});
|
|
@@ -374,7 +374,7 @@
|
|
|
374
374
|
* Login with username/password
|
|
375
375
|
*/
|
|
376
376
|
async loginWithPassword(username, password, redirectUri) {
|
|
377
|
-
return this.request(`/auth/${this.appId}/
|
|
377
|
+
return this.request(`/api/auth/${this.appId}/login`, {
|
|
378
378
|
method: "POST",
|
|
379
379
|
body: JSON.stringify({
|
|
380
380
|
username,
|
|
@@ -387,7 +387,7 @@
|
|
|
387
387
|
* Handle OAuth callback
|
|
388
388
|
*/
|
|
389
389
|
async handleOAuthCallback(code, state) {
|
|
390
|
-
return this.request(`/auth/${this.appId}/oauth/callback`, {
|
|
390
|
+
return this.request(`/api/auth/${this.appId}/oauth/callback`, {
|
|
391
391
|
method: "POST",
|
|
392
392
|
body: JSON.stringify({ code, state }),
|
|
393
393
|
});
|
|
@@ -401,7 +401,7 @@
|
|
|
401
401
|
token: token,
|
|
402
402
|
app_id: this.appId,
|
|
403
403
|
});
|
|
404
|
-
const response = (await this.request(`/auth/verify-token?${params.toString()}`, {
|
|
404
|
+
const response = (await this.request(`/api/auth/verify-token?${params.toString()}`, {
|
|
405
405
|
method: "GET",
|
|
406
406
|
}));
|
|
407
407
|
if (!response.valid) {
|
|
@@ -428,7 +428,7 @@
|
|
|
428
428
|
* Refresh access token
|
|
429
429
|
*/
|
|
430
430
|
async refreshToken(refreshToken) {
|
|
431
|
-
return this.request("/auth/refresh-token", {
|
|
431
|
+
return this.request("/api/auth/refresh-token", {
|
|
432
432
|
method: "POST",
|
|
433
433
|
body: JSON.stringify({ refresh_token: refreshToken }),
|
|
434
434
|
});
|
|
@@ -437,13 +437,13 @@
|
|
|
437
437
|
* Get JWKS for token verification
|
|
438
438
|
*/
|
|
439
439
|
async getJWKS() {
|
|
440
|
-
return this.request("/auth/jwks");
|
|
440
|
+
return this.request("/api/auth/jwks");
|
|
441
441
|
}
|
|
442
442
|
/**
|
|
443
443
|
* Exchange authorization code for tokens (hosted auth callback)
|
|
444
444
|
*/
|
|
445
445
|
async exchangeCodeForTokens(code, redirectUri) {
|
|
446
|
-
const result = await this.request("/auth/callback", {
|
|
446
|
+
const result = await this.request("/api/auth/callback", {
|
|
447
447
|
method: "POST",
|
|
448
448
|
body: JSON.stringify({
|
|
449
449
|
code,
|