A TypeScript project demonstrating OAuth2 token management with proper testing and Docker support.
- Node.js 20.x or higher
- npm
- Docker (for containerized testing)
npm installnpm testdocker build -t ai-assignment-test .docker run ai-assignment-testThe Docker container will automatically run:
npm testand display the test results.
The HttpClient.request() method failed to refresh OAuth2 tokens when oauth2Token was a plain JavaScript object instead of an OAuth2Token instance. This resulted in missing Authorization headers in outgoing requests.
Modified the token validation logic in src/httpClient.ts to properly handle plain object tokens by checking the instance type before attempting to access instance-specific properties.