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

# SuperOffice.WebApi.Authorization.AuthorizationAccessToken

# \<a id="SuperOffice\_WebApi\_Authorization\_AuthorizationAccessToken">\</a> Class AuthorizationAccessToken

Namespace: [SuperOffice.WebApi.Authorization](SuperOffice.WebApi.Authorization.md)\
Assembly: SuperOffice.WebApi.Authorization.AccessToken.dll

OAuth 2.0 access token (and refresh token) \<xref href="SuperOffice.WebApi.Authorization.IAuthorization" data-throw-if-not-resolved="false">\</xref>.
With a refresh token, AppToken and AppSecret defined we can automatically
refresh access token on expiry.

```csharp theme={null}
public class AuthorizationAccessToken : IAuthorization
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[AuthorizationAccessToken](SuperOffice.WebApi.Authorization.AuthorizationAccessToken.md)

#### Implements

IAuthorization

#### Inherited Members

[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring),
[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)),
[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)),
[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype),
[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)

## Constructors

### \<a id="SuperOffice\_WebApi\_Authorization\_AuthorizationAccessToken\_\_ctor\_System\_String\_">\</a> AuthorizationAccessToken(string)

AccessTokenAuthorization Constructor. Using this constructor will not renew an access token when it has expired.

```csharp theme={null}
public AuthorizationAccessToken(string accessToken)
```

#### Parameters

`accessToken` [string](https://learn.microsoft.com/dotnet/api/system.string)

An OAuth 2.0 access\_token.

### \<a id="SuperOffice\_WebApi\_Authorization\_AuthorizationAccessToken\_\_ctor\_System\_String\_System\_String\_System\_String\_System\_String\_System\_String\_System\_String\_">\</a> AuthorizationAccessToken(string, string, string, string, string, string)

AccessTokenAuthorization Constructor. This will attempt to renew the access token when it has expired.

```csharp theme={null}
public AuthorizationAccessToken(string accessToken, string refreshToken, string clientId, string clientSecret, string redirectUrl, string subdomain = "online")
```

#### Parameters

`accessToken` [string](https://learn.microsoft.com/dotnet/api/system.string)

An OAuth 2.0 access\_token.

`refreshToken` [string](https://learn.microsoft.com/dotnet/api/system.string)

Refresh token that can be used to get a new access token.

`clientId` [string](https://learn.microsoft.com/dotnet/api/system.string)

Client identifier, equal to OAuth client\_id.

`clientSecret` [string](https://learn.microsoft.com/dotnet/api/system.string)

CLient Secret, equal to Oauth client\_secret. This is required for WebApps, but not for Native/Mobile apps.

`redirectUrl` [string](https://learn.microsoft.com/dotnet/api/system.string)

Redirect URL registered to your app

`subdomain` [string](https://learn.microsoft.com/dotnet/api/system.string)

Determines CRM online subdomain, i.e. sod, qastage or online.

### \<a id="SuperOffice\_WebApi\_Authorization\_AuthorizationAccessToken\_\_ctor\_System\_String\_System\_String\_System\_String\_System\_String\_System\_String\_">\</a> AuthorizationAccessToken(string, string, string, string, string)

AccessTokenAuthorization Constructor. This will attempt to renew the access token when it has expired for Native/Mobile apps, which don't require a ClientSecret.

```csharp theme={null}
public AuthorizationAccessToken(string accessToken, string refreshToken, string clientId, string redirectUrl, string subdomain = "online")
```

#### Parameters

`accessToken` [string](https://learn.microsoft.com/dotnet/api/system.string)

An OAuth 2.0 access\_token.

`refreshToken` [string](https://learn.microsoft.com/dotnet/api/system.string)

Refresh token that can be used to get a new access token.

`clientId` [string](https://learn.microsoft.com/dotnet/api/system.string)

Client identifier, equal to OAuth client\_id.

`redirectUrl` [string](https://learn.microsoft.com/dotnet/api/system.string)

Redirect URL registered to your app

`subdomain` [string](https://learn.microsoft.com/dotnet/api/system.string)

Determines CRM online subdomain, i.e. sod, qastage or online.

## Properties

### \<a id="SuperOffice\_WebApi\_Authorization\_AuthorizationAccessToken\_AccessToken">\</a> AccessToken

OAuth access\_token value.

```csharp theme={null}
public string AccessToken { get; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### \<a id="SuperOffice\_WebApi\_Authorization\_AuthorizationAccessToken\_ClientId">\</a> ClientId

OAuth client\_id value.

```csharp theme={null}
public string ClientId { get; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### \<a id="SuperOffice\_WebApi\_Authorization\_AuthorizationAccessToken\_ClientSecret">\</a> ClientSecret

OAuth client\_secret value.

```csharp theme={null}
public string ClientSecret { get; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### \<a id="SuperOffice\_WebApi\_Authorization\_AuthorizationAccessToken\_IdToken">\</a> IdToken

OAuth id\_token value.

```csharp theme={null}
public string IdToken { get; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### \<a id="SuperOffice\_WebApi\_Authorization\_AuthorizationAccessToken\_RedirectUrl">\</a> RedirectUrl

OAuth redirect\_uri value.

```csharp theme={null}
public string RedirectUrl { get; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### \<a id="SuperOffice\_WebApi\_Authorization\_AuthorizationAccessToken\_RefreshAuthorizationAsync">\</a> RefreshAuthorizationAsync

Try to refresh this \<xref href="SuperOffice.WebApi.Authorization.IAuthorization" data-throw-if-not-resolved="false">\</xref> instance.

```csharp theme={null}
public Func<ReAuthorizationArgs, Task<IAuthorization>> RefreshAuthorizationAsync { get; set; }
```

#### Property Value

[Func](https://learn.microsoft.com/dotnet/api/system.func-2)\<ReAuthorizationArgs, [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<IAuthorization\&gt;\&gt;

### \<a id="SuperOffice\_WebApi\_Authorization\_AuthorizationAccessToken\_RefreshToken">\</a> RefreshToken

OAuth refresh\_token value.

```csharp theme={null}
public string RefreshToken { get; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### \<a id="SuperOffice\_WebApi\_Authorization\_AuthorizationAccessToken\_SubDomain">\</a> SubDomain

SuperOffice CRM Online subdomain; SOD, Stage, Production.

```csharp theme={null}
public string SubDomain { get; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

## Methods

### \<a id="SuperOffice\_WebApi\_Authorization\_AuthorizationAccessToken\_GetAuthorization">\</a> GetAuthorization()

Gets a tuple that represents authorization scheme and parameter.

```csharp theme={null}
public AuthenticationHeaderValue GetAuthorization()
```

#### Returns

[AuthenticationHeaderValue](https://learn.microsoft.com/dotnet/api/system.net.http.headers.authenticationheadervalue)

Gets a \<xref href="System.Tuple%602" data-throw-if-not-resolved="false">\</xref> (string,string) where scheme is Bearer and parameter is the access token.


## Related topics

- [SuperOffice.WebApi.Authorization](/en/api/reference/webapi/SuperOffice.WebApi.Authorization.md)
- [SuperOffice.WebApi.WebApiOptions](/en/api/reference/webapi/SuperOffice.WebApi.WebApiOptions.md)
- [SuperOffice.WebApi](/en/api/reference/webapi/SuperOffice.WebApi.md)
- [SuperOffice.WebApi.SubDomain](/en/api/reference/webapi/SuperOffice.WebApi.SubDomain.md)
- [SuperOffice.WebApi.AuthorizationUserToken](/en/api/reference/webapi/SuperOffice.WebApi.AuthorizationUserToken.md)
- [How to get all user-defined fields using the web services API](/en/api/web-services/howto/custom-objects/rest-get-all-udef-fields.md)
