For AI agents: the documentation index is at llms.txt. Guide pages have a markdown version at the same path with .md appended, before any query string or fragment.
Swift: Initialize client session
Returns once the client has read the stored session, so status is no longer .loading.
The client reads storage asynchronously after it is created. Until then, currentSession is nil. Call this method before you read currentSession or currentUser at launch.
When the client refreshes an expired stored session first, this method waits for that refresh too, for at most initialRefreshTimeout.
While storage cannot be read, for example after a launch into the background before the first unlock, this method waits until it can. It returns early when the calling task is canceled.
Examples
Wait for the initial session
await supabase.auth.initialization()
if let session = supabase.auth.currentSession {
print("Signed in as \(session.user.id)")
}