feat(oauth): add OAuth token support
This commit is contained in:
21
readme.md
21
readme.md
@@ -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
|
||||
|
Reference in New Issue
Block a user