feat(oauth): add OAuth token support

This commit is contained in:
2025-07-22 21:10:41 +00:00
parent 4b398b56da
commit cffba39844
7 changed files with 117 additions and 2 deletions

View File

@@ -428,6 +428,27 @@ const payment = await BunqPayment.builder(bunq, account)
// The same request ID will return the original payment without creating a duplicate
```
### OAuth Token Support
```typescript
// Using OAuth access token instead of API key
const bunq = new BunqAccount({
apiKey: 'your-oauth-access-token', // OAuth token from bunq OAuth flow
deviceName: 'OAuth App',
environment: 'PRODUCTION',
isOAuthToken: true // Important: Set this flag for OAuth tokens
});
await bunq.init();
// OAuth tokens already have an associated session from the OAuth flow,
// so the library will skip session creation and use the token directly
const accounts = await bunq.getAccounts();
// Note: OAuth tokens have their own expiry mechanism managed by bunq's OAuth server
// The library will not attempt to refresh OAuth tokens
```
### Error Handling
```typescript