fix(oauth): fix OAuth token authentication flow for existing installations
This commit is contained in:
@@ -64,10 +64,10 @@ export class BunqAccount {
|
||||
const errorMessages = error.errors.map(e => e.error_description).join(' ');
|
||||
if (errorMessages.includes('Superfluous authentication') ||
|
||||
errorMessages.includes('Authentication token already has a user session')) {
|
||||
console.log('OAuth token already has an active session, attempting to reuse...');
|
||||
// Try to use the token directly without creating new session
|
||||
await this.apiContext.initWithExistingSession();
|
||||
// Cache the context with existing session
|
||||
console.log('OAuth token already has installation/device, attempting to create new session...');
|
||||
// Try to create a new session with existing installation/device
|
||||
await this.apiContext.initWithExistingInstallation();
|
||||
// Cache the context with new session
|
||||
BunqAccount.oauthSessionCache.set(cacheKey, this.apiContext);
|
||||
} else {
|
||||
throw error;
|
||||
|
Reference in New Issue
Block a user