> ## 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

<h1 id="SuperOffice_WebApi_Authorization_AuthorizationAccessToken">
  Class AuthorizationAccessToken
</h1>

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

<h3 id="SuperOffice_WebApi_Authorization_AuthorizationAccessToken__ctor_System_String_">
  AuthorizationAccessToken(string)
</h3>

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.

<h3 id="SuperOffice_WebApi_Authorization_AuthorizationAccessToken__ctor_System_String_System_String_System_String_System_String_System_String_System_String_">
  AuthorizationAccessToken(string, string, string, string, string, string)
</h3>

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.

<h3 id="SuperOffice_WebApi_Authorization_AuthorizationAccessToken__ctor_System_String_System_String_System_String_System_String_System_String_">
  AuthorizationAccessToken(string, string, string, string, string)
</h3>

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

<h3 id="SuperOffice_WebApi_Authorization_AuthorizationAccessToken_AccessToken">
  AccessToken
</h3>

OAuth access\_token value.

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

#### Property Value

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

<h3 id="SuperOffice_WebApi_Authorization_AuthorizationAccessToken_ClientId">
  ClientId
</h3>

OAuth client\_id value.

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

#### Property Value

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

<h3 id="SuperOffice_WebApi_Authorization_AuthorizationAccessToken_ClientSecret">
  ClientSecret
</h3>

OAuth client\_secret value.

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

#### Property Value

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

<h3 id="SuperOffice_WebApi_Authorization_AuthorizationAccessToken_IdToken">
  IdToken
</h3>

OAuth id\_token value.

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

#### Property Value

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

<h3 id="SuperOffice_WebApi_Authorization_AuthorizationAccessToken_RedirectUrl">
  RedirectUrl
</h3>

OAuth redirect\_uri value.

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

#### Property Value

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

<h3 id="SuperOffice_WebApi_Authorization_AuthorizationAccessToken_RefreshAuthorizationAsync">
  RefreshAuthorizationAsync
</h3>

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;

<h3 id="SuperOffice_WebApi_Authorization_AuthorizationAccessToken_RefreshToken">
  RefreshToken
</h3>

OAuth refresh\_token value.

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

#### Property Value

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

<h3 id="SuperOffice_WebApi_Authorization_AuthorizationAccessToken_SubDomain">
  SubDomain
</h3>

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

<h3 id="SuperOffice_WebApi_Authorization_AuthorizationAccessToken_GetAuthorization">
  GetAuthorization()
</h3>

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)
