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
True once configure has accepted a configuration.
Functions
Records the configuration this library will use. Call once, as early as possible — Application.onCreate and your iOS app's initialiser are both fine.
Configures NAVER Login with an explicit Context.
The access token this device currently holds, or null if there is none.
Disconnects the user's NAVER account from this application: revokes the grant with NAVER and drops the local tokens.
Whether this device holds a token at all.
Whether the NAVER app is installed on this device.
Whether the NAVER app is installed on this device, asked with an explicit Context.
Signs the user in, suspending until they finish, cancel, or the attempt fails.
Signs the user out of this device: drops the tokens stored here.
Fetches the signed-in user's profile from NAVER.
Makes the signed-in user prove who they are again.