Chuyển tới nội dung chính

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

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}")
}
}
}

Guest Session

// Web example — similar API on Android/iOS
const guest = await VLPlaySDK.auth.loginAsGuest();
console.log('Guest ID:', guest.user.userId);

User Object

FieldTypeDescription
userIdstringUnique VLPlay user ID
displayNamestringPlayer display name
emailstring | nullEmail (null for guests)
avatarUrlstring | nullAvatar image URL
isGuestbooleanWhether this is a guest session