# ExternalIdentityProvider

    protocol ExternalIdentityProvider : Sendable

Interface required to participate in Identity flows.

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


  ### [activeAccount()](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/ExternalIdentityProvider#/s:13GoogleHomeSDK24ExternalIdentityProviderP13activeAccountAA0E6ResultOyYaF)


  ` 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 -> https://developers.home.google.com/reference/swift/GoogleHomeSDK/Enums/IdentityResult.html

- `


  ### [signIn(scopes:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/ExternalIdentityProvider#/s:13GoogleHomeSDK24ExternalIdentityProviderP6signIn6scopesAA0E6ResultOShySSG_tYaF)


  ` 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 -> https://developers.home.google.com/reference/swift/GoogleHomeSDK/Enums/IdentityResult.html

  #### Parameters

  |---|---|
  | ` scopes ` | Required OAuth scopes for authorization. Returns the IdentityResult. |

- `


  ### [accessToken(for:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/ExternalIdentityProvider#/s:13GoogleHomeSDK24ExternalIdentityProviderP11accessToken3forAA06AccessH0OAA9AccountIDV_tYaF)


  ` 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: https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/AccountID.html) async -> https://developers.home.google.com/reference/swift/GoogleHomeSDK/Enums/AccessToken.html

- `


  ### [invalidateAccessToken(for:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/ExternalIdentityProvider#/s:13GoogleHomeSDK24ExternalIdentityProviderP21invalidateAccessToken3foryAA9AccountIDV_tYaF)


  ` 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: https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/AccountID.html) async