feat(core): add set_session to QbzCore and login_with_session to CoreBridge for OAuth

This commit is contained in:
vicrodh committed 2026-02-23 14:45:24 -06:00
1 parent 5ed96c1d2d
commit 9d6be623d4
2 files changed
+22

No files matched your search

+13
View File
@@ -109,6 +109,19 @@ impl<A: FrontendAdapter + Send + Sync + 'static> QbzCore<A> {
}
}
/// Inject an already-authenticated session (e.g. from OAuth flow).
/// Emits a LoggedIn event so the rest of the system knows auth state changed.
pub async fn set_session(&self, session: UserSession) -> Result<(), CoreError> {
let client = self.client.read().await;
let client = client.as_ref().ok_or(CoreError::NotInitialized)?;
client.set_session(session.clone()).await;
self.emit(CoreEvent::LoggedIn {
session,
})
.await;
Ok(())
}
/// Logout the current user
pub async fn logout(&self) -> Result<(), CoreError> {
let client = self.client.read().await;