-
Notifications
You must be signed in to change notification settings - Fork 37
Chore: custom-token-exchange implementation #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| }); | ||
|
|
||
| // Start the server | ||
| const server = app.listen(config.port, () => { |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 14 days ago
To fix the problem, simply remove the assignment of the result of app.listen(config.port, ...) to the unused variable server. Call app.listen(config.port, ...) directly without assigning it to any variable. There is no need to make any additional code changes, imports, or definitions, as this fix is self-contained to the server startup code. Only the affected line needs to be changed in the packages/examples/custom-token-exchange-example.ts file.
-
Copy modified line R610
| @@ -607,7 +607,7 @@ | ||
| }); | ||
|
|
||
| // Start the server | ||
| const server = app.listen(config.port, () => { | ||
| app.listen(config.port, () => { | ||
| console.log(`Custom Token Exchange Example Server running on port ${config.port}`); | ||
| console.log('Available endpoints:'); | ||
| console.log(' POST /oauth/token/basic - Basic token exchange'); |
| @@ -0,0 +1,996 @@ | |||
| import { Request, Response } from 'express'; | |||
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 14 days ago
To resolve the issue of the unused import, simply remove Response from the import statement on line 1. Retain only Request if it is used, otherwise if neither is used, remove the whole curly braces import. In this code, Request is not referenced either, so the curly brace import could be removed entirely unless Request is used elsewhere in the file not shown.
Since CodeQL only flagged Response as unused, and not Request, we make the minimal fix: remove Response from the import statement, leaving the import of Request intact.
Edit only line 1 of packages/express-oauth2-jwt-bearer/test/custom-token-exchange.test.ts, removing Response from the import.
-
Copy modified line R1
| @@ -1,4 +1,4 @@ | ||
| import { Request, Response } from 'express'; | ||
| import { Request } from 'express'; | ||
| import express from 'express'; | ||
| import request from 'supertest'; | ||
| import * as jwt from 'jsonwebtoken'; |
Description
This PR adds comprehensive OAuth 2.0 Token Exchange (RFC 8693) support to the express-oauth2-jwt-bearer middleware, enabling secure token transformation and delegation scenarios.
Key Features
Checklist