Skip to content

Conversation

@varsha766
Copy link
Collaborator

🎯 Purpose

Why is this change needed? (problem it solves or value it adds)

  • Removed sensitive detail from token
  • Used redis to read app detail
  • Deleted redis key once we delete app

📝 Changes

  • Brief list of main updates

🔄 Type

  • 🚀 Feature
  • 🐛 Fix
  • 📝 Docs
  • ♻️ Refactor
  • ✅ Tests
  • 🔧 Config / CI

🧪 Testing

How did you test this? (unit/integration/manual)


✅ Checklist

  • Code follows Hypermine standards
  • Tests/docs updated if needed
  • Verified locally

appId: string,
user,
): Promise<{ access_token; expiresIn; tokenType }> {
const context = Context.idDashboard;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any where else in this function , use of this variable context ??

I can see its used in const sessionId = ${appId}_${context};

but if we do not use it anywhere elese then we can directly use this like const sessionId = ${appId}_${Context.idDashboard}` ?

public async getAccessToken(data, expiresin = 4) {
const secret = this.config.get('JWT_SECRET');
const token = await this.jwt.signAsync(data, {
expiresIn: expiresin.toString() + 'h',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if I want to issue tokens in like min , I can not do becuae the expiry is always in hourh?

subdomain: app.subdomain,
sessionId,
};
return this.getAccessToken(dataToStore, 12);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we keep this expiry 12 some where in one place? so that we can look at that file and would know whats this exipry for?

sessionId,
};
await this.storeDataInRedis(grantType, app, accessList, sessionId);
return this.getAccessToken(tokenPayload, 12);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we keep this expiry 12 some where in one place? so that we can look at that file and would know whats this exipry for?

sessionId,
JSON.stringify(creditPayload),
'EX',
5 * TIME.MINUTE,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also keep all redis related expiry at one place.

customerOnboardingData.kycSubdomain,
sessionId: kycRedisKey,
},
4,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep this expiry 4 somewhere at one place

VERIFIER_TOKEN: {
name: 'verifierPageToken',
expiry: 30 * TIME.MINUTE,
jwtExpiry: 0.5,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep this expiry 0.5 somewhere at one place

sessionId: ssiServiceId,
subdomain: ssiServiceDetail.subdomain,
},
0.5,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep this expiry 0.5 somewhere at one place

sessionId: appId,
subdomain: kycServiceDetail.subdomain,
},
0.5,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep this expiry 0.5 somewhere at one place

Logger.log('generateAccessToken() method: ends....', 'AppAuthService');

return { access_token: token, expiresIn, tokenType: 'Bearer' };
redisClient.set(sessionId, JSON.stringify(payload), 'EX', TIME.WEEK);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets keep expiry in one place for reddis

@varsha766 varsha766 requested a review from Vishwas1 December 10, 2025 16:01
@Vishwas1 Vishwas1 merged commit 6cd8c05 into secure/token Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants