Sign in with logi — drop-in Android SDK for logi (1pass.dev) Relying Parties.
OAuth 2.0 Authorization Code + PKCE (S256). Custom Tabs + Intent app-to-app handoff.
settings.gradle.kts 에 JitPack repo 추가:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://jitpack.io") // 추가
}
}app/build.gradle.kts 에 의존성 추가:
dependencies {
implementation("com.github.dcode-co.logi-auth-android:logi-auth-android:v1.3.1")
// 선택 — 토큰 저장 유틸이 필요할 때만:
implementation("com.github.dcode-co.logi-auth-android:logi-auth-storage:v1.3.1")
}implementation("com.dcodelabs.logi:logi-auth-android:1.3.1")🚧 2026 Q3 publish 예정. 그 전까지는 JitPack 사용.
// MyApplication.kt
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
LogiAuth.configure(this, LogiAuthConfig(
issuer = "https://api.1pass.dev",
clientId = "logi_xxxxxxxxxxxxxxxx", // start.1pass.dev/developer 에서 발급
redirectUri = "myapp://oauth/1pass/callback",
scopes = listOf("openid", "profile:basic", "email"),
))
}
}authorize 핸드오프 호스트 (v1.2.0~) —
signIn()의 두 갈래는 같은 인가 요청을 서로 다른 호스트로 보낸다. 쿼리(state·nonce·code_challenge)는 동일하고 host 만 다르다.
갈래 호스트 이유 네이티브 app-to-app open.1pass.devassetlinks 가 /oauth/authorize*를 claim → logi 앱이 열린다Custom Tabs 폴백 issuer호스트 =api.1pass.devclaim 이 없어야 브라우저 로그인이 가로채이지 않는다 🔴 폴백을 claim 된 호스트로 보내면 안 된다. 그 갈래에 도달하는 사용자는 logi 앱 미설치 사용자뿐이고, 그들에게는 그 갈래가 로그인 전부다.
⚠️ 이행 중(2026-08-15) —api.1pass.dev는 아직com.dcodelabs.logi로 verified 상태다(기기에서pm get-app-links로 확인). claim 제거는 모든 RP 가 호스트 분리 SDK 로 올라간 뒤다 — 먼저 걷어내면 구버전 SDK 를 쓰는 RP 의 앱 자동 점프가 즉시 끊긴다. 그동안 폴백은 SDK 가 Custom Tab 을 브라우저 패키지에 고정해 지킨다(고정하지 않으면 verified 앱이 ACTION_VIEW 를 브라우저보다 먼저 가져간다).stock 프로덕션 issuer(
https://api.1pass.dev)면 SDK 가 자동으로 파생하므로 설정할 것이 없다. 스테이징·자체호스팅은 파생하지 않고(다른 배포로 authorize 를 던지게 되므로) 두 갈래 모두 그 issuer 호스트에 남으니, 자체 부처를 운영한다면nativeAuthorizeHost로 직접 지정한다.issuer는 그대로다 — 토큰 교환·JWKS·id_tokeniss검증은 전부issuer바인딩을 유지한다.
AndroidManifest.xml:
<application android:name=".MyApplication" ...>
<!-- SDK 가 제공하는 callback Activity. 본인의 scheme 만 채우면 됨. -->
<activity
android:name="com.dcodelabs.logi.sdk.LogiAuthCallbackActivity"
android:exported="true"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" android:host="oauth" />
</intent-filter>
</activity>
</application>class LoginActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
Button(onClick = {
lifecycleScope.launch {
val result = LogiAuth.signIn(this@LoginActivity).getOrElse { e ->
Toast.makeText(this@LoginActivity, e.message, Toast.LENGTH_LONG).show()
return@launch
}
// result.accessToken / result.idToken / result.refreshToken
Log.i("Login", "✅ ${result.accessToken.take(12)}…")
}
}) {
Text("logi 로 로그인")
}
}
}
}:logi-auth-sdk — 인증만 담당한다.
| Method | Returns | Notes |
|---|---|---|
LogiAuth.configure(context, config) |
Unit |
Application.onCreate 에서 1회 |
LogiAuth.signIn(activity, scopes?) |
Result<LogiSession> |
suspend; app-to-app → Custom Tabs |
LogiAuth.authorize(activity, startUri) |
Result<LogiCallback> |
suspend; BFF(백엔드 주도) 흐름 |
LogiAuth.isLogiAppInstalled(context) |
Boolean |
sync; 버튼 문구 분기용 |
:logi-auth-storage — 토큰 저장은 RP 의 결정이라 별도 모듈이다. 저장을 원할 때만 붙인다.
| Method | Returns | Notes |
|---|---|---|
LogiAuthStorage(context, config) |
— | 생성자. config 는 위와 같은 값 |
storage.persist(session) |
Unit |
🔴 signIn() 성공 후 직접 호출. 코어는 저장하지 않는다 |
storage.refresh() |
Result<LogiAuthResult> |
suspend; 저장된 refresh token 사용 |
storage.signOut() |
Unit |
token store wipe |
storage.currentRefreshToken() |
String? |
sync; cold-start 분기용 |
storage.currentAccessToken() |
String? |
sync; 만료됐을 가능성 있음 |
v0.x 에서 올라온다면:
refresh/signOut/current*Token이LogiAuth정적 메서드에서 이 인스턴스 메서드로 옮겨졌고,signIn후 저장이 자동에서 수동(persist)으로 바뀌었다.persist를 빠뜨리면 앱 재시작마다 로그인이 풀린다. 저장 좌표 (logi_auth_sdk_<clientId>)는 그대로라 기존 사용자 세션은 유지된다.
에러 타입 (LogiAuthError): NotConfigured, InvalidAuthorizeUrl, MissingStateInStartUri,
StateMismatch, UserCancelled, HandoffTimeout, AlreadyInProgress, NoRefreshToken,
MissingIdToken, IdTokenInvalid, JwksFetchFailed, TokenEndpoint, Network.
signIn() / authorize() 는 무한히 기다리지 않는다. 콜백이 300초 안에 도착하지
않으면 LogiAuthError.HandoffTimeout 으로 실패하고, 단일 비행 슬롯을 반납한다.
그래서 마감 직후의 재시도는 AlreadyInProgress 가 아니라 정상 수락된다. iOS
logi-auth-swift 와 같은 값이며, 설정으로 노출하지 않는다.
더 일찍 끊으려면 코루틴을 취소한다. 별도 API 가 필요 없다 — signIn() 은
suspend 함수이고 취소 시 내부 정리가 그대로 돈다.
val result = withTimeoutOrNull(60_000) { LogiAuth.signIn(activity) }
?: return // 1분 안에 안 돌아오면 포기. 슬롯은 이미 반납됨알려진 한계 — 분할화면: 분할화면·프리폼에서는 logi 앱이 옆 창에 떠도 RP 액티비티가
stop/resume 되지 않는다(API 29+ multi-resume). SDK 의 취소 감지가 lifecycle 콜백에
의존하므로 이 경우 마감이 유일한 종결자다. 사용자가 승인 없이 이탈하면 최대 5분간
대기가 유지된다. 이 UX 가 문제라면 위 withTimeout 으로 앱 정책에 맞는 상한을 직접 건다.
- App-to-app first:
Intent(ACTION_VIEW, authorizeUrl).setPackage("com.dcodelabs.logi")로 logi 앱이 설치된 경우 즉시 핸드오프. - Custom Tabs fallback: 미설치(또는 핸드오프 실패) 시
CustomTabsIntent로 브라우저. 인텐트를 브라우저 패키지에 고정해 App Links claim 이 폴백을 가로채지 못하게 한다. - EncryptedSharedPreferences: refresh token 저장 (AES-256-GCM, AndroidKeyStore-backed).
- PKCE S256: code_verifier 메모리, code_challenge 만 전송.
- Zero project deps:
:core:*,:feature:*모듈 의존성 없음. Hilt/Compose/Retrofit 사용 여부 무관하게 drop-in.
SDK 가 consumer-rules.pro 를 동봉하므로 추가 설정 불필요.
iOS (logi-auth-swift) |
Android (this SDK) |
|---|---|
LogiAuth.configure(LogiAuthConfig) |
LogiAuth.configure(Context, LogiAuthConfig) |
LogiAuth.signIn(scopes:) async throws |
suspend fun signIn(activity, scopes) |
LogiAuth.refresh() async throws |
suspend fun refresh() |
LogiAuth.signOut() |
LogiAuth.signOut() |
| Keychain (iOS) | EncryptedSharedPreferences |
ASWebAuthenticationSession |
CustomTabsIntent + LogiAuthCallbackActivity |
v1.3.x— current stable. minSdk 23, target SDK 35, Kotlin 2.1+, JDK 17.- Semantic versioning. Tag
vX.Y.Z.
MIT. See LICENSE.