fix(oauth): remove OAuth session caching to prevent authentication issues
This commit is contained in:
29
readme.md
29
readme.md
@@ -449,35 +449,6 @@ const accounts = await bunq.getAccounts();
|
||||
|
||||
// According to bunq documentation:
|
||||
// "Just use the OAuth Token (access_token) as a normal bunq API key"
|
||||
|
||||
// OAuth Session Caching (v3.0.9+)
|
||||
// The library automatically caches OAuth sessions to prevent multiple authentication attempts
|
||||
|
||||
// Multiple instances with the same OAuth token will reuse the cached session
|
||||
const bunq1 = new BunqAccount({
|
||||
apiKey: 'your-oauth-access-token',
|
||||
deviceName: 'OAuth App Instance 1',
|
||||
environment: 'PRODUCTION',
|
||||
isOAuthToken: true
|
||||
});
|
||||
|
||||
const bunq2 = new BunqAccount({
|
||||
apiKey: 'your-oauth-access-token', // Same token
|
||||
deviceName: 'OAuth App Instance 2',
|
||||
environment: 'PRODUCTION',
|
||||
isOAuthToken: true
|
||||
});
|
||||
|
||||
await bunq1.init(); // Creates new session
|
||||
await bunq2.init(); // Reuses cached session from bunq1
|
||||
|
||||
// This prevents "Superfluous authentication" errors when multiple instances
|
||||
// try to authenticate with the same OAuth token
|
||||
|
||||
// Cache management methods
|
||||
BunqAccount.clearOAuthCache(); // Clear all cached OAuth sessions
|
||||
BunqAccount.clearOAuthCacheForToken('token', 'PRODUCTION'); // Clear specific token
|
||||
const cacheSize = BunqAccount.getOAuthCacheSize(); // Get current cache size
|
||||
```
|
||||
|
||||
### Error Handling
|
||||
|
Reference in New Issue
Block a user