Revert "fix(getUser): prefer stored userinfo over ID token for username claim"
Some checks failed
armco-org/iam-client-sdk/pipeline/head There was a failure building this commit

This reverts commit f51f5c8148.
This commit is contained in:
2026-01-26 19:04:10 +05:30
parent f51f5c8148
commit 90d665250f

View File

@@ -329,21 +329,9 @@ export class StuffleIAMClient {
}
/**
* Get current user from stored userinfo or ID token
* Prefers stored userinfo (from fetchUserInfo) as it has more claims like username
* Get current user from stored ID token
*/
getUser(): User | null {
// First try stored userinfo (has username and other claims from /userinfo endpoint)
const storedUser = this.storage.get(STORAGE_KEYS.USER);
if (storedUser) {
try {
return JSON.parse(storedUser) as User;
} catch {
// Fall through to ID token
}
}
// Fallback to ID token (may not have all claims like username)
const idToken = this.storage.get(STORAGE_KEYS.ID_TOKEN);
if (!idToken) return null;