Table of Contents

Class AuthorizationServerErrorText

Namespace
MailFathom.Common.OAuth
Assembly
MailFathom.Common.dll

Reduces an authorization server's error value to a form that is safe to put in a message.

public static class AuthorizationServerErrorText
Inheritance
AuthorizationServerErrorText
Inherited Members

Remarks

The value is the one useful thing a rejected grant returns — it separates a revoked refresh token from a mistyped client secret — and it is also attacker-influenced text from a machine this process does not own. RFC 6749 gives it a character set and no length bound at all, so a replaced or misconfigured server can answer with kilobytes of anything and have it copied into an operator's log through an exception message.

Sanitizing rather than rejecting keeps the diagnostic: an unrecognized code from a provider that invented one is still worth showing, so what is removed is the ability to inject line breaks, control characters, or bulk. A value that survives none of it reads as unspecified, which is accurate — the server said nothing usable.

Methods

Sanitize(string?)

Reduces a server-supplied error code to printable, single-line text of bounded length.