> ## Documentation Index
> Fetch the complete documentation index at: https://ai.easyaf.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# OAuthChallenge

> One parsed `WWW-Authenticate` challenge: the authentication scheme, the OAuth-relevant auth-params promoted to typed properties, and the complete, case-insen...

## Definition

**Assembly:** Microsoft.OData.Mcp.Authentication.dll

**Namespace:** Microsoft.OData.Mcp.Authentication.Outbound

**Inheritance:** System.Object

## Syntax

```csharp theme={null}
Microsoft.OData.Mcp.Authentication.Outbound.OAuthChallenge
```

## Summary

One parsed `WWW-Authenticate` challenge: the authentication scheme, the OAuth-relevant auth-params
promoted to typed properties, and the complete, case-insensitive parameter set exactly as it arrived.

## Remarks

Instances are produced by [WwwAuthenticateParser](https://ai.easyaf.dev/odata-mcp/api-reference/Microsoft/OData/Mcp/Authentication/Outbound/WwwAuthenticateParser.md) and are immutable once created.
[OAuthChallenge.ResourceClientId](https://ai.easyaf.dev/odata-mcp/api-reference/Microsoft/OData/Mcp/Authentication/Outbound/OAuthChallenge.md#resourceclientid) carries the challenge `client_id`, which is the \<em>resource\</em>
application id (Microsoft Graph advertises
[ODataMcpAuthConstants.MicrosoftGraphResourceAppId](https://ai.easyaf.dev/odata-mcp/api-reference/Microsoft/OData/Mcp/Authentication/Outbound/ODataMcpAuthConstants.md#microsoftgraphresourceappid)). It is never our public client id and
must never be copied onto an outbound OAuth client id; that is why no member of this type is named
`ClientId`.

## Examples

```csharp theme={null}
var challenge = WwwAuthenticateParser.SelectBearer(WwwAuthenticateParser.ParseAll(result.WwwAuthenticate));
if (challenge is not null &amp;&amp; challenge.ResourceMetadata is not null)
{
    // Fetch RFC 9728 protected resource metadata from challenge.ResourceMetadata.
}
```

## Constructors

### &#x20;.ctor

#### Syntax

```csharp theme={null}
public OAuthChallenge()
```

### &#x20;.ctor Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public Object()
```

## Properties

### &#x20;AuthorizationUri

The challenge `authorization_uri` as an absolute URI, or [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when the
parameter is absent or not an absolute URI.

#### Syntax

```csharp theme={null}
public System.Uri AuthorizationUri { get; init; }
```

#### Property Value

Type: `System.Uri?`

#### Remarks

A non-absolute value is still available verbatim through [OAuthChallenge.Parameters](https://ai.easyaf.dev/odata-mcp/api-reference/Microsoft/OData/Mcp/Authentication/Outbound/OAuthChallenge.md#parameters).

### &#x20;Error

The RFC 6750 `error` code, such as `invalid_token`, or [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when absent.

#### Syntax

```csharp theme={null}
public string Error { get; init; }
```

#### Property Value

Type: `string?`

### &#x20;ErrorDescription

The RFC 6750 `error_description` human readable text, or [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when absent.

#### Syntax

```csharp theme={null}
public string ErrorDescription { get; init; }
```

#### Property Value

Type: `string?`

### &#x20;Parameters

Every auth-param of the challenge, including the ones promoted to typed properties, keyed
case-insensitively with values unescaped but otherwise verbatim.

#### Syntax

```csharp theme={null}
public System.Collections.Generic.IReadOnlyDictionary<string, string> Parameters { get; init; }
```

#### Property Value

Type: `System.Collections.Generic.IReadOnlyDictionary<string, string>`

#### Remarks

Defaults to an empty dictionary so callers never have to null-check it.

### &#x20;Realm

The RFC 7235 `realm`, or [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when absent. An advertised but empty realm
(Microsoft Graph sends `realm=""`) is preserved as an empty string.

#### Syntax

```csharp theme={null}
public string Realm { get; init; }
```

#### Property Value

Type: `string?`

### &#x20;ResourceClientId

The challenge `client_id`, which identifies the protected \<em>resource\</em> application, or
[`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when absent.

#### Syntax

```csharp theme={null}
public string ResourceClientId { get; init; }
```

#### Property Value

Type: `string?`

#### Remarks

Per AUTH-13 this value is never used as the client id of the OAuth client this process runs.

### &#x20;ResourceMetadata

The RFC 9728 `resource_metadata` location as an absolute URI, or [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when
the parameter is absent or not an absolute URI.

#### Syntax

```csharp theme={null}
public System.Uri ResourceMetadata { get; init; }
```

#### Property Value

Type: `System.Uri?`

#### Remarks

A non-absolute value is still available verbatim through [OAuthChallenge.Parameters](https://ai.easyaf.dev/odata-mcp/api-reference/Microsoft/OData/Mcp/Authentication/Outbound/OAuthChallenge.md#parameters).

### &#x20;Scheme

The authentication scheme, such as `Bearer` or `Basic`, exactly as the server spelled it.

#### Syntax

```csharp theme={null}
public string Scheme { get; init; }
```

#### Property Value

Type: `string`

#### Remarks

Schemes are case-insensitive; compare with [OrdinalIgnoreCase](https://learn.microsoft.com/dotnet/api/system.stringcomparison.ordinalignorecase) or use
[OAuthChallenge})](https://learn.microsoft.com/dotnet/api/microsoft.odata.mcp.authentication.outbound.wwwauthenticateparser.selectbearer\(system.collections.generic.ireadonlylist\{microsoft.odata.mcp.authentication.outbound.oauthchallenge}\)).

### &#x20;Scope

The space-delimited `scope` the server asks for, or [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when absent.

#### Syntax

```csharp theme={null}
public string Scope { get; init; }
```

#### Property Value

Type: `string?`

## Methods

### &#x20;Equals Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public virtual bool Equals(object obj)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `obj` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;Equals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public static bool Equals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;GetHashCode Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public virtual int GetHashCode()
```

#### Returns

Type: `int`

### &#x20;GetType Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public System.Type GetType()
```

#### Returns

Type: `System.Type`

### &#x20;MemberwiseClone Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
protected internal object MemberwiseClone()
```

#### Returns

Type: `object`

### &#x20;ReferenceEquals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public static bool ReferenceEquals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;ToString Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public virtual string ToString()
```

#### Returns

Type: `string?`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.