UserScopedPermissionsController

struct UserScopedPermissionsController
extension UserScopedPermissionsController : Sendable

A Controller class for interacting with user-scoped permissions.

  • Requests an offline access code from the authorization service, if configured with a server client ID.

    Declaration

    Swift

    func requestOfflineAccess() async -> String?

    Return Value

    The offline access code, or nil if the request failed.

  • Presents a view for users to update the permissions granted to the Home SDK.

    Declaration

    Swift

    func presentPermissionsUpdate(structureID: String? = nil, allowedStructureIDs: [String]? = nil, allowStructureChange: Bool = false) async

    Parameters

    structureID

    An optional HGS ID of the structure to be pre-selected.

    allowedStructureIDs

    An optional list of HGS structure IDs to which the user’s choice should be restricted.

    allowStructureChange

    An optional Boolean indicating whether the user is allowed to select a different structure. Defaults to false.

  • Returns a current access token and assertion for the current user.

    Throws

    HomeError.permissionDenied

    Declaration

    Swift

    func authorization() async throws -> (accessToken: String, assertion: Data)