@passkeyme/auth 2.1.0 → 2.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/dist/index.esm.js +49 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +49 -0
- package/dist/index.umd.js.map +1 -1
- package/dist/src/api-client.d.ts +6 -0
- package/dist/src/api-client.d.ts.map +1 -1
- package/dist/src/passkeyme-auth.d.ts +7 -0
- package/dist/src/passkeyme-auth.d.ts.map +1 -1
- package/dist/src/types.d.ts +14 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -425,6 +425,29 @@
|
|
|
425
425
|
lastLoginAt: new Date().toISOString(),
|
|
426
426
|
};
|
|
427
427
|
}
|
|
428
|
+
/**
|
|
429
|
+
* Get detailed user information from /userinfo endpoint
|
|
430
|
+
* Returns rich user data including name, picture, etc.
|
|
431
|
+
* Requires a valid access token.
|
|
432
|
+
*/
|
|
433
|
+
async getUserInfo(accessToken) {
|
|
434
|
+
const response = (await this.request("/userinfo", {
|
|
435
|
+
method: "GET",
|
|
436
|
+
headers: {
|
|
437
|
+
Authorization: `Bearer ${accessToken}`,
|
|
438
|
+
},
|
|
439
|
+
}));
|
|
440
|
+
// Convert userinfo response to User object
|
|
441
|
+
return {
|
|
442
|
+
id: response.sub,
|
|
443
|
+
email: response.email,
|
|
444
|
+
name: response.name || response.email,
|
|
445
|
+
givenName: response.given_name,
|
|
446
|
+
familyName: response.family_name,
|
|
447
|
+
picture: response.picture,
|
|
448
|
+
emailVerified: response.email_verified,
|
|
449
|
+
};
|
|
450
|
+
}
|
|
428
451
|
/**
|
|
429
452
|
* Refresh access token
|
|
430
453
|
*/
|
|
@@ -1691,6 +1714,32 @@
|
|
|
1691
1714
|
});
|
|
1692
1715
|
return this._appConfigPromise;
|
|
1693
1716
|
}
|
|
1717
|
+
/**
|
|
1718
|
+
* Get detailed user information including name, picture, etc.
|
|
1719
|
+
* Requires the user to be authenticated.
|
|
1720
|
+
* This calls the /userinfo endpoint which returns richer user data
|
|
1721
|
+
* than what's available from the JWT token alone.
|
|
1722
|
+
*/
|
|
1723
|
+
async getUserInfo() {
|
|
1724
|
+
const accessToken = await this.getAccessToken();
|
|
1725
|
+
if (!accessToken) {
|
|
1726
|
+
throw new PasskeymeError({
|
|
1727
|
+
code: exports.PasskeymeErrorCode.SESSION_EXPIRED,
|
|
1728
|
+
message: "No access token available",
|
|
1729
|
+
userMessage: "Please sign in to view user information.",
|
|
1730
|
+
recoverable: true,
|
|
1731
|
+
retryable: false,
|
|
1732
|
+
suggestedAction: "Sign in again",
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
const userInfo = await this.apiClient.getUserInfo(accessToken);
|
|
1736
|
+
// Update state with enriched user data
|
|
1737
|
+
this.setState({
|
|
1738
|
+
user: { ...this._state.user, ...userInfo },
|
|
1739
|
+
});
|
|
1740
|
+
logger.debug("User info retrieved:", userInfo);
|
|
1741
|
+
return userInfo;
|
|
1742
|
+
}
|
|
1694
1743
|
}
|
|
1695
1744
|
// Test comment
|
|
1696
1745
|
|