LineLogin

object LineLogin

LINE Login, driven from shared code.

// once, at startup
LineLogin.configure(LineLoginConfig(channelId = "1234567890"))

// wherever the user taps "Sign in with LINE"
when (val result = LineLogin.login()) {
is LineLoginResult.Success -> println(result.profile?.displayName)
LineLoginResult.Cancelled -> Unit
is LineLoginResult.Failure -> println(result.message)
}

Underneath, this is LINE's own Android SDK on Android and LINE's own iOS SDK on iOS — the same app-to-app login, the same browser fallback, the same token storage. Only the API is shared.

Why an object

Not a design preference: LoginManager on iOS is a process-wide singleton whose setup is one-shot and asserts if called twice. An API that let you construct several clients would be lying about what the platform can do.

Properties

Link copied to clipboard

True once configure has run successfully.

Functions

Link copied to clipboard

Prepares the LINE SDK. Call once, as early as possible — App.onCreate and your iOS app's initialiser are both fine, and so is any shared startup code that runs before the first login.

Link copied to clipboard
fun LineLogin.configure(context: Context, config: LineLoginConfig)

Configures LINE Login with an explicit Context.

Link copied to clipboard

The access token this device currently holds, or null if there is none.

Link copied to clipboard

Whether the LINE app is installed on this device.

Link copied to clipboard
fun LineLogin.isLineAppInstalled(context: Context): Boolean

Whether the LINE app is installed on this device, asked with an explicit Context.

Link copied to clipboard
suspend fun isLoggedIn(): Boolean

Whether this device holds a token at all.

Link copied to clipboard
suspend fun login(request: LineLoginRequest = LineLoginRequest()): LineLoginResult

Signs the user in, suspending until they finish, cancel, or the attempt fails.

Link copied to clipboard
suspend fun logout(): LineLogoutResult

Signs the user out: clears the credentials this device holds and revokes the token with LINE.

Link copied to clipboard

The login LINE completed while your app was not running, or null when there is none.