Skip to main content

Legacy Android Authentication

Deprecated — do not use for new games

Legacy Android SDK is in maintenance-only mode and will be removed. New games must use SDK v2 Authentication.

The legacy Android SDK is UI-first. Most account flows are launched directly from OegSdk.

Show login

Kotlin:

OegSdk.showLogin(
callBack = object : AuthenticationCallBack {
override fun onChangePassResult(changePasswordResult: WorkResult<Boolean>) = Unit

override fun onAuthenticationResult(
action: AuthenticationAction,
authenticationResult: WorkResult<AuthenticationInfo>,
provider: String?
) {
if (authenticationResult.isSuccess()) {
val auth = authenticationResult.data()
println("Logged in: ${auth?.uuid}")
} else {
println(authenticationResult.error()?.message)
}
}
},
orientation = OegSdk.ScreenOrientation.PORTRAIT
)

Java:

OegSdk.INSTANCE.showLogin(callback, null, OegSdk.ScreenOrientation.PORTRAIT);

Read current session

val authInfo = OegSdk.getAuthenticationInfo()
val savedUser = OegSdk.getSavedUserInfo()

AuthenticationInfo contains the fields most games use immediately:

  • apiToken
  • uuid
  • username
  • isPlayNow

Logout

OegSdk.logout()

Change password

OegSdk.showChangePassword(
callBack = object : AuthenticationCallBack {
override fun onAuthenticationResult(
action: AuthenticationAction,
authenticationResult: WorkResult<AuthenticationInfo>,
provider: String?
) = Unit

override fun onChangePassResult(changePasswordResult: WorkResult<Boolean>) {
if (changePasswordResult.isSuccess()) {
println("Password changed")
}
}
},
orientation = OegSdk.ScreenOrientation.PORTRAIT
)

Update user profile

OegSdk.showUpdateUserInfo(
callBack = object : UserCallBack {
override fun onUpdateInfoResult(result: WorkResult<UserInfo>) {
if (result.isSuccess()) {
println("Profile updated")
}
}
},
orientation = OegSdk.ScreenOrientation.PORTRAIT
)

Screen orientation

All legacy UI entry points accept:

  • OegSdk.ScreenOrientation.PORTRAIT
  • OegSdk.ScreenOrientation.LANDSCAPE

Use portrait unless your game specifically needs landscape SDK screens.