Authentication Forwarding
Forward your host app's authentication token to the StreamLayer SDK so users authenticate once.
If your host app already authenticates users (for example, via phone number verification), you can forward that authentication token to the StreamLayer SDK. This lets your users access all StreamLayer features — gamification, chat, and profile — without authenticating a second time.
Forward the Token
Call setAuthorizationBypass after your app completes its own authentication flow:
do {
try await StreamLayer.setAuthorizationBypass(token: "YOUR_TOKEN", schema: "YOUR SCHEMA")
// authorization is successful
} catch {
// there is some error during authorization
}When the token is valid, the SDK creates a local user entry from the backend response and skips its own authentication steps on future launches.
What Happens Without Authentication
If the host app does not forward a token, users can still view content inside the StreamLayer Element. However, interactive features — gamification units, chat, and profile — will prompt the user with a "Sign up to enable this option" alert.
Log Out
To clear the user's local cache and remove their data from the SDK's database, call:
StreamLayer.logout()Related
- Integration Guide — Full setup walkthrough including SDK initialization
- Silent Mode Guide — Disable notifications for a minimal integration
Updated 15 days ago
