Authentication
VLPlay SDK provides a unified authentication system across Android, iOS, and Web. [PLACEHOLDER] Players can log in with their VLPlay account, Google, or Facebook. Guest sessions are also supported for games that want to allow play before registration. All authentication flows use OAuth 2.0 and tokens are managed automatically by the SDK.
[PLACEHOLDER] Once authenticated, the SDK stores the session securely (Keychain on iOS, EncryptedSharedPreferences on Android, localStorage on Web) and refreshes tokens transparently. Your game code only needs to handle the login trigger and the resulting user object.
Login
- Android
- iOS
- Web
VLPlaySDK.auth.login(activity) { result ->
when (result) {
is AuthResult.Success -> {
val user = result.user
Log.d("VLPlay", "Welcome ${user.displayName}")
}
is AuthResult.Error -> {
Log.e("VLPlay", "Login error: ${result.message}")
}
}
}
do {
let user = try await VLPlaySDK.auth.login(from: viewController)
print("Welcome \(user.displayName)")
} catch {
print("Login error: \(error)")
}
const result = await VLPlaySDK.auth.login();
if (result.success) {
console.log('Welcome', result.user.displayName);
}
Guest Session
// Web example — similar API on Android/iOS
const guest = await VLPlaySDK.auth.loginAsGuest();
console.log('Guest ID:', guest.user.userId);
User Object
| Field | Type | Description |
|---|---|---|
userId | string | Unique VLPlay user ID |
displayName | string | Player display name |
email | string | null | Email (null for guests) |
avatarUrl | string | null | Avatar image URL |
isGuest | boolean | Whether this is a guest session |