Add invalid_target oauth error (rfc 8707) (#1183)

Co-authored-by: Eduardo Gomes <egomes@cloudflare.com>
Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
This commit is contained in:
Eduardo Gomes 2025-11-28 12:59:59 +01:00 • committed by GitHub
commit 5e97e1a479
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -163,6 +163,14 @@ export class InsufficientScopeError extends OAuthError {
static errorCode = 'insufficient_scope';
}
/**
* Invalid target error - The requested resource is invalid, missing, unknown, or malformed.
* (Custom error for resource indicators - RFC 8707)
*/
export class InvalidTargetError extends OAuthError {
static errorCode = 'invalid_target';
}
/**
* A utility class for defining one-off error codes
*/
@ -199,5 +207,6 @@ export const OAUTH_ERRORS = {
[MethodNotAllowedError.errorCode]: MethodNotAllowedError,
[TooManyRequestsError.errorCode]: TooManyRequestsError,
[InvalidClientMetadataError.errorCode]: InvalidClientMetadataError,
[InsufficientScopeError.errorCode]: InsufficientScopeError
[InsufficientScopeError.errorCode]: InsufficientScopeError,
[InvalidTargetError.errorCode]: InvalidTargetError
} as const;