Show / Hide Table of Contents

ClearAuthToken Method

ClearAuthToken()

Reset the AuthToken, AuthTokenPermissions, and AuthTokenRelyingPartyId to null, so that any future operation that retrieves an AuthToken will not use the current values.

C#
public void ClearAuthToken()

Remarks

See the User's Manual entry for a deeper discussion of FIDO2 authentication and how AuthTokens, permissions, PIN/UV, and AuthParams fit together.

See also the User's Manual entry on the SDK's AuthToken logic. That article goes into greater detail how this method, as well as other operations, perform "automatic" AuthToken retrieval based on the version of the connected YubiKey, the state of the Fido2 application on the YubiKey, the input, and the state of the Fido2Session.

Generally you will begin a Fido2Session with a call to AddPermissions(PinUvAuthTokenPermissions, string?). If the AuthToken is expired, and an AuthToken is needed for a new operation, the SDK will obtain a new AuthToken, using the original permissions (and any new permissions needed by the operation) and the AuthTokenRelyingPartyId.

However, if you want to set the AuthTokenPermissions to a completely new value that does not have the same permission set as the current, or set it to be associated with a new relying party, or with no relying party at all, then clear the current set of values.

If you ever need to clear the AuthToken and associated properties, you will likely follow up a call to this method with a call to AddPermissions to start a new process.

In this article
Back to top Generated by DocFX