NaverLogin

object NaverLogin

NAVER Login, driven from shared code.

// once, at startup
NaverLogin.configure(
NaverLoginConfig(
clientId = "…",
clientSecret = "…",
clientName = "My App",
urlScheme = "myapp", // iOS only
),
)

// wherever the user taps "네이버로 로그인"
when (val result = NaverLogin.login()) {
is NaverLoginResult.Success -> useToken(result.accessToken)
NaverLoginResult.Cancelled -> Unit
is NaverLoginResult.Failure -> showError(result.message)
}

Underneath, this is NAVER's own Android SDK on Android and NAVER'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: both SDKs are process-wide singletons whose setup is one-shot, and the iOS one reports a second setup as an error. An API that let you construct several clients would be lying about what the platforms can do.

Properties

Link copied to clipboard

True once configure has accepted a configuration.

Functions

Link copied to clipboard

Records the configuration this library will use. Call once, as early as possible — Application.onCreate and your iOS app's initialiser are both fine.

Link copied to clipboard
fun NaverLogin.configure(context: Context, config: NaverLoginConfig)

Configures NAVER 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

Disconnects the user's NAVER account from this application: revokes the grant with NAVER and drops the local tokens.

Link copied to clipboard
suspend fun isLoggedIn(): Boolean

Whether this device holds a token at all.

Link copied to clipboard

Whether the NAVER app is installed on this device.

Link copied to clipboard
fun NaverLogin.isNaverAppInstalled(context: Context): Boolean

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

Link copied to clipboard
suspend fun login(request: NaverLoginRequest = NaverLoginRequest()): NaverLoginResult

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

Link copied to clipboard
suspend fun logout(): NaverLogoutResult

Signs the user out of this device: drops the tokens stored here.

Link copied to clipboard

Fetches the signed-in user's profile from NAVER.

Link copied to clipboard

Makes the signed-in user prove who they are again.