ExternalIdentityProvider

protocol ExternalIdentityProvider : Sendable

Interface required to participate in Identity flows.

NOTE: Method calls are externally synchronized, but may occur on any thread.

  • Returns the AccountID of the current active User, if there is one.

    NOTE: May be called from any thread.

    If an account is returned, it will be used as the active account. If .continue is returned, the SDK will fallback to other IdentityProviders.

    Declaration

    Swift

    func activeAccount() async -> IdentityResult
  • Called by the SDK to sign in a new User.

    Parameters:

    • scopes: Required OAuth scopes for authorization. Returns the IdentityResult.

    Declaration

    Swift

    func signIn(scopes: Set<String>) async -> IdentityResult

    Parameters

    scopes

    Required OAuth scopes for authorization. Returns the IdentityResult.

  • Called by the SDK to perform something on a User’s behalf.

    The returned access token should have all of the required scopes from the most recent signIn call.

    Parameters:

    • accountID - The accountID for the requesting User. May be nil if there is no active User, in which case the IdentityProvider may return an access token for any User (a.k.a. Sign-In). Returns a current access token, may refresh if needed.

    Declaration

    Swift

    func accessToken(for accountID: AccountID) async -> AccessToken
  • Called by the SDK when a user has asked to sign out or revoke access.

    Parameters:

    • accountID - The accountID for the access token to invalidate.

    Declaration

    Swift

    func invalidateAccessToken(for accountID: AccountID) async