Hosted login for Apple apps.
Rust core · npm · PyPI · RubyGems
smbcloud-auth-swift is the Swift package for smbCloud Auth on Apple platforms.
It gives you:
SmbCloudWebAuthSmbCloudSessionSmbCloudCredentialsManagerSmbCloudUserInfoClient
The package is built for public clients:
- Authorization Code + PKCE
ASWebAuthenticationSession- Keychain-backed local session storage
- no shipped client secret
Developer preview. The hosted-login MVP is in place and ready to try.
Use File → Add Package Dependencies and enter:
https://github.com/smbcloudXYZ/smbcloud-auth-swift
dependencies: [
.package(url: "https://github.com/smbcloudXYZ/smbcloud-auth-swift", from: "1.0.1")
],
targets: [
.target(name: "MyApp", dependencies: [
.product(name: "SmbCloudAuth", package: "smbcloud-auth-swift")
])
]import SmbCloudAuth
let webAuth = try SmbCloudWebAuth(
domain: "api.smbcloud.xyz",
clientId: "your-public-client-id",
redirectURL: URL(string: "myapp://auth/callback")!
)
let credentials = SmbCloudCredentialsManager(
service: "com.example.myapp.smbcloud-auth"
)
let session = try await webAuth.login(
presentationAnchorProvider: {
window
},
credentialsManager: credentials
)
let user = try await webAuth.userInfo(session: session)
print(user.email ?? "Signed in")| Platform | Minimum |
|---|---|
| iOS | 16.0 |
| macOS | 14.0 |
| tvOS | 16.0 |
| visionOS | 1.0 |
Hosted web login currently runs on iOS, macOS, and visionOS. The session, storage, and user info helpers can still be used on other supported Apple platforms.
- Use a public client ID.
- Do not embed an smbCloud Auth
app_secretin the app. - Use system browser auth, not embedded webviews.
- If you need native email/password forms, keep confidential credentials on your backend or BFF.
logout()currently clears local credentials only.
- Quick Start — iOS
- Quick Start — macOS
- Migration from proxy/native-form auth
- Hosted login example
- Release process
Clone this repo alongside smbcloud-cli:
Repositories/
├── smbcloud-cli/
└── smbcloud-auth-swift/
Build the optional local XCFramework and UniFFI shim from the Rust source:
make ios
make macos
make tvos
make visionosThe public SmbCloudAuth product builds without local Rust artifacts. SmbCloudAuthFFI is there for sibling-repo development when you need the local bridge.
Apache 2.0. See LICENSE.
© 2025 smbCloud.