···39394040## Authenticate the User
41414242-EffemKit relies on CoreATProtocol for OAuth authentication. Once the user signs in through CoreATProtocol, the PDS host is automatically available and ``EffemRepoService`` can write records:
4242+EffemKit re-exports CoreATProtocol's OAuth types under `Effem*` names so you only need `import EffemKit`. Create an ``EffemOAuth`` instance, configure it, and run the authentication flow:
43434444```swift
4545-// After CoreATProtocol OAuth flow completes,
4646-// APEnvironment.current.host is set to the user's PDS.
4747-// No additional EffemKit configuration is needed for writes.
4545+import EffemKit
4646+4747+@APActor
4848+func signIn(presentURL: @escaping (URL) async -> URL) async throws -> EffemAuthResult {
4949+ let config = EffemOAuthConfig(
5050+ clientMetadataURL: "https://effem.xyz/client-metadata.json",
5151+ redirectURI: "effem://oauth/callback",
5252+ scopes: ["atproto", "transition:generic"]
5353+ )
5454+5555+ let oauth = EffemOAuth(config: config)
5656+ return try await oauth.authenticate(
5757+ identifier: "alice.bsky.social",
5858+ authenticator: presentURL
5959+ )
6060+}
4861```
6262+6363+After authentication succeeds, CoreATProtocol's `APEnvironment` is automatically configured with the user's PDS host, access token, and DPoP keys. ``EffemRepoService`` can immediately write records — no additional setup needed.
6464+6565+For a full walkthrough of the OAuth flow, token refresh, and session persistence, see <doc:Authentication>.
49665067## Read Data with EffemService
5168