Entity Auth

SDK (Swift)

EntityAuth.shared APIs for iOS and macOS

SDK (Swift)

Import EntityKit and use the shared singleton.

import EntityKit
let ea = EntityAuth.shared
ea.updateBaseURL("https://api.example.com")

Auth

  • register(email:password:tenantId:)
  • login(email:password:tenantId:) → sets accessToken, userId, sessionId
  • refresh()
  • logout()

Organizations

  • createOrg(tenantId:name:slug:ownerId:)
  • addMember(orgId:userId:role:)
  • switchOrg(orgId:)

Users

  • getUserMe()
  • userByUsername(_:)
  • userByEmail(_:)
  • setUsername(_:)
  • checkUsernameAvailability(_:)

Realtime

After login, the SDK subscribes to the current user for live updates.

Best practices

Store the refresh token in Keychain (handled by the SDK) and call refresh() on 401 when making manual requests.