#### [Abblix\.Oidc](https://www.abblix.com/docs/api/abblix-oidc 'index')
### [Abblix\.Oidc](https://www.abblix.com/docs/api/abblix-oidc/Abblix.Oidc 'Abblix\.Oidc')

## CodeChallenge Class

The PKCE code challenge \(RFC 7636\): what a client sends with its authorization request and an authorization
server recomputes from the verifier presented at the token endpoint\.

```csharp
public static class CodeChallenge
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → CodeChallenge
### Methods

## CodeChallenge\.Calculate\(string, string\) Method {#Abblix.Oidc.CodeChallenge.Calculate(string,string)}

Calculates the code challenge from a code verifier and a method \(RFC 7636 section 4\.2\)\.
PKCE involves transforming the code verifier into a code challenge, which the authorization server verifies when
exchanging the authorization code for a token\. This method ensures that the correct transformation is applied\.
It supports both 'plain' and 'S256' methods, with 'S256' being the recommended approach for stronger security\.

```csharp
public static string Calculate(string method, string codeVerifier);
```
#### Parameters

###### `method` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.CodeChallenge.Calculate(string,string).method}

The PKCE challenge method, either 'plain', 'S256' or 'S512'\.

###### `codeVerifier` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.CodeChallenge.Calculate(string,string).codeVerifier}

The code verifier submitted by the client during the token request\.

#### Returns
[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')  
The transformed code challenge based on the specified method\.

## CodeChallenge\.IsWellFormed\(string\) Method {#Abblix.Oidc.CodeChallenge.IsWellFormed(string)}

Whether [value](https://www.abblix.com/docs/api/abblix-oidc/Abblix.Oidc.CodeChallenge#Abblix.Oidc.CodeChallenge.IsWellFormed(string).value 'Abblix\.Oidc\.CodeChallenge\.IsWellFormed\(string\)\.value') has the syntax both a code verifier and a code challenge share: OAuth 2\.1
\(draft\-ietf\-oauth\-v2\-1\-17\) section 4\.1\.1 and RFC 7636 sections 4\.1 and 4\.2, "code\-verifier = 43\*128unreserved"
and "code\-challenge = 43\*128unreserved", where "unreserved = ALPHA / DIGIT / "\-" / "\." / "\_" / "~""\.

```csharp
public static bool IsWellFormed(string value);
```
#### Parameters

###### `value` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.CodeChallenge.IsWellFormed(string).value}

A code verifier or a code challenge as sent\.

#### Returns
[System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')
