@ssktechnologies/awsforge
Version:
Enterprise-grade AWS Cognito authentication toolkit for seamless user management, registration, login, and password recovery with JWT token handling
14 lines (13 loc) • 393 B
JavaScript
// src/utils/tokenManager.ts
export function extractTokens(response) {
const auth = response.AuthenticationResult;
if (!auth) {
throw new Error("Authentication failed: No AuthenticationResult present.");
}
return {
accessToken: auth.AccessToken,
idToken: auth.IdToken,
refreshToken: auth.RefreshToken,
expiresIn: auth.ExpiresIn
};
}