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

# \<a id="SuperOffice\_WebApi\_AuthorizationUserToken">\</a> Class AuthorizationUserToken

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

Username and password are used to get an access token from given username and password
If the access token is invalidated, will try to authenticate with username and password to get a new access token.
The current access token can be retrieved with \<pre>\<code class="lang-csharp">var (\_, accessToken) = authInstance.GetAuthorization();\</code>\</pre>

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

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[AuthorizationUserToken](SuperOffice.WebApi.AuthorizationUserToken.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)

## Remarks

If the access token is omitted on construction, the first agent call will result in three requests:

1. The first agent call which will fail
2. A call to UserAgent.GetCurrentToken with the username and passwor to obtain an access token
3. The original agent call which should now succeed with the new access token

## Constructors

### \<a id="SuperOffice\_WebApi\_AuthorizationUserToken\_\_ctor\_System\_String\_System\_String\_System\_String\_">\</a> AuthorizationUserToken(string, string, string)

```csharp theme={null}
public AuthorizationUserToken(string userName, string password, string accessToken = null)
```

#### Parameters

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

Users name.

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

Users password.

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

Optional access token. Should be a 8A: style bearer token, same as what UserAgent.GetCurrentToken will deliver

## Properties

### \<a id="SuperOffice\_WebApi\_AuthorizationUserToken\_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;

## Methods

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

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

#### Returns

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


## Related topics

- [SuperOffice.WebApi](/en/api/reference/webapi/SuperOffice.WebApi.md)
- [SuperOffice.WebApi.Authorization.AuthorizationSystemUserTicket](/en/api/reference/webapi/SuperOffice.WebApi.Authorization.AuthorizationSystemUserTicket.md)
- [SuperOffice.WebApi.Authorization](/en/api/reference/webapi/SuperOffice.WebApi.Authorization.md)
- [SuperOffice.WebApi.Authorization.AuthorizationAccessToken](/en/api/reference/webapi/SuperOffice.WebApi.Authorization.AuthorizationAccessToken.md)
- [SuperOffice.WebApi.WebApiOptions](/en/api/reference/webapi/SuperOffice.WebApi.WebApiOptions.md)
- [SuperOffice.WebApi.Agents.UserAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.UserAgent.md)
