Table of Contents

Class AppleAuthenticationProvider

Namespace
VpnHood.AppLib.Stores.AppStore
Assembly
VpnHood.AppLib.Stores.AppStore.dll

Sign in with Apple (ASAuthorizationAppleIdProvider — fully bound in Microsoft.iOS, no Swift needed). Returns the identity token JWS, which the portal's POST /auth/sessions verifies against Apple's published keys.

public class AppleAuthenticationProvider : IAuthenticationExternalProvider, IDisposable
Inheritance
AppleAuthenticationProvider
Implements
Inherited Members

Properties

ProviderId

The identity provider this implementation drives, self-declared as a free-form string id (lowercase by convention; see AuthProviders for the well-known ones) so nothing downstream ever hardcodes it: the portal sends it verbatim as the wire discriminator, AppDescriptor reports it, and the UI picks the matching "Sign in with X" label. A string rather than an enum so a third-party app on these packages can add its own provider — no library change, no consumer changes.

public string ProviderId { get; }

Property Value

string

Remarks

It is Apple.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

SignIn(IUiContext?, bool, CancellationToken)

Signs the person in with the identity provider.

public Task<string> SignIn(IUiContext? uiContext, bool isSilentLogin, CancellationToken cancellationToken)

Parameters

uiContext IUiContext

The window, or null where none is open.

isSilentLogin bool

true where the person did not ask to sign in, as for a renewal, so the provider avoids a prompt where it can.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<string>

A task whose result is the identity provider's ID token.

Remarks

It asks for the email address too, and gives Apple's identity token, a JWS the portal verifies against Apple's published keys. Apple has no silent sign-in: a silent one needs the app in front.

Exceptions

UiContextNotAvailableException

uiContext is null, and the provider shows a sheet.

AuthenticationException

The identity provider gave no ID token, as Google's where the device has no Google account.

InvalidOperationException

isSilentLogin is true where the provider cannot sign in without the person, as Apple's while the app is not in front.

OperationCanceledException

The person canceled the sign-in, or cancellationToken was canceled.

AuthenticationException

Apple's sign-in failed, or gave no identity token.

SignOut(IUiContext?, CancellationToken)

Clears the identity provider's sign-in on this device, where it keeps one.

public Task SignOut(IUiContext? uiContext, CancellationToken cancellationToken)

Parameters

uiContext IUiContext

The window, or null where none is open.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that represents the asynchronous operation.

Remarks

It does nothing: Apple has no sign-out on the device, and the portal's session revoke is the sign-out.

Exceptions

UiContextNotAvailableException

uiContext is null, and the provider needs a window to clear it.

ApiException

The platform failed to clear it, as Google's credential manager reports a failure or a cancel.