Skip to content

Conversation

@wille
Copy link
Contributor

@wille wille commented Nov 14, 2025

Summary

Add support for OAuth 2.0 Token Revocation

Linked issue(s)

#343

Involved parts of the project

A new 'revoke' handler is added.

Added tests?

Not yet. This is a draft looking for feedback.

OAuth2 standard

https://datatracker.ietf.org/doc/html/rfc7009

Reproduction

I'm gonna add support in https://github.com/node-oauth/express-oauth-server and the examples repo

Copy link
Member

@jankapunkt jankapunkt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much! This is a great addition to the library and I'd like to move forward with this, unless there are strong objections by @jorenvandeweyer @HappyZombies @shrihari-prakash @dhensby

My suggestion is to make unit and integration tests with focus on standard compliance, before further improving the code. I can support you especially with additional tests if you want to.

However, I am less of a help in regards to TypeScript related things. For this I'd like to add one of you guys for final review phase.

@wille feel free to continue in draft or review-ready mode whenever you like and ping me in the comment if you need anything.

Much appreciated!

// attempted to authenticate via the "Authorization" request header.
//
// @see https://tools.ietf.org/html/rfc6749#section-5.2.
if (error instanceof InvalidClientError && request.get('authorization')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this even happen at any circumstance?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Client might be including the client_id and client_secret using Basic authentication in the authorization header, but I don't think www-authenticate should be returned. I'll be removing this clause.


// Validate token_type_hint if provided
if (tokenTypeHint && tokenTypeHint !== 'access_token' && tokenTypeHint !== 'refresh_token') {
throw new UnsupportedTokenTypeError('Unsupported token_type_hint: ' + tokenTypeHint);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really the appropriate error type? From my understanding this error type is defined for the server not supporting the revocation at all? The RFC is a bit ambiguous here...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just read it again and you're right.

@wille
Copy link
Contributor Author

wille commented Nov 15, 2025

Thank you for your reply. I will build proper unit tests for this feature asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants