Skip to main content

Definition

Assembly: Microsoft.OData.Mcp.Authentication.dll Namespace: Microsoft.OData.Mcp.Authentication.Outbound Inheritance: System.Exception

Syntax

Summary

The single exception type an outbound token, device authorization, or polling request throws when the authorization server answers with an RFC 6749 section 5.2 error payload, or when the request never reached one.

Remarks

Per AUTH-12 no member of this type ever carries an access token, refresh token, device code, or client secret: OAuthTokenException.Error and OAuthTokenException.ErrorDescription are copied straight from the server’s error payload, and the composed Message repeats only those two values and the HTTP status. RFC 8628 device code polling reuses this type for its authorization_pending, slow_down, expired_token, and access_denied answers, which is why OAuthTokenException.Error is exposed as a value a caller can branch on rather than only formatted into the message.

Examples

Constructors

.ctor

Initializes a new instance of the OAuthTokenException class for an error payload the authorization server returned.

Syntax

Parameters

Exceptions

.ctor

Initializes a new instance of the OAuthTokenException class for an error payload the authorization server returned, or a transport failure, that another exception caused.

Syntax

Parameters

Exceptions

.ctor

Initializes a new instance of the OAuthTokenException class with a message and the exception that caused this failure.

Syntax

Parameters

Remarks

OAuthTokenException.Error reads as Empty and OAuthTokenException.StatusCode as 0 for an instance built this way, because neither an error code nor a response status is known.

Properties

Error

Gets the RFC 6749 error code the authorization server returned, such as invalid_grant, or transport_error when the request never reached a server.

Syntax

Property Value

Type: string Empty when this instance was constructed with only a message and an inner exception.

ErrorDescription

Gets the human readable error_description the authorization server returned, or null when it supplied none.

Syntax

Property Value

Type: string?

StatusCode

Gets the HTTP status code the failing request returned.

Syntax

Property Value

Type: int 0 when the request never produced a response, such as a transport failure.