Class UserInfoProvider
Provides access to a UserInfo instance returned from a cloud endpoint.
Inherited Members
Namespace: Unity.Cloud.Identity
Syntax
public class UserInfoProvider : IUserInfoProvider
Constructors
UserInfoProvider(IServiceHttpClient, IServiceHostResolver)
Provides access to a UserInfo instance returned from a cloud endpoint.
Declaration
public UserInfoProvider(IServiceHttpClient serviceHttpClient, IServiceHostResolver serviceHostResolver)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceHttpClient | serviceHttpClient | An IServiceHttpClient instance. |
| IServiceHostResolver | serviceHostResolver | The service host resolver for the service Url. |
Examples
CompositeAuthenticator m_CompositeAuthenticator;
IAuthenticatedUserInfoProvider m_AuthenticatedUserInfoProvider => m_CompositeAuthenticator;
async Task CreateUserInfoProvider()
{
var playerSettings = UnityCloudPlayerSettings.Instance;
var httpClient = new UnityHttpClient();
var serviceHostResolver = UnityRuntimeServiceHostResolverFactory.Create();
var compositeAuthenticatorSettings = new CompositeAuthenticatorSettingsBuilder(httpClient, PlatformSupportFactory.GetAuthenticationPlatformSupport(), serviceHostResolver)
.AddDefaultBrowserAuthenticatedAccessTokenProvider(playerSettings)
.AddDefaultPersonalAccessTokenProvider()
.AddDefaultPkceAuthenticator(playerSettings)
.Build();
m_CompositeAuthenticator = new CompositeAuthenticator(compositeAuthenticatorSettings);
await m_CompositeAuthenticator.InitializeAsync();
}
Methods
GetUserInfoAsync()
Retrieves a UserInfo instance from a cloud endpoint.
Declaration
public async Task<UserInfo> GetUserInfoAsync()
Returns
| Type | Description |
|---|---|
| Task<UserInfo> | A task that results in a UserInfo instance after completion. |
Implements
Exceptions
| Type | Condition |
|---|---|
| HttpRequestException | Thrown when the request fails to complete. See the returned StatusCode for more details. |
| UnauthorizedException | |
| ConnectionException | |
| ForbiddenException |