# 설치

## 요구사항 <a href="#requirements" id="requirements"></a>

* **Android**: API 버전 <mark style="color:blue;">**21**</mark> 이상
* **iOS**: 버전 <mark style="color:blue;">**13.0**</mark> 이상
  * Compose Multiplatform 프로젝트의 `ios/Podfile`에서 `platform :ios` 버전을 <mark style="color:blue;">**13.0**</mark> 으로 업데이트하고, 필요에 따라 `ios/Podfile`을 확인하고 수정해야 합니다.

{% hint style="info" %}
해당 패키지는 Android, iOS 환경에서만 사용 가능합니다. Web, MacOS, Window, Linux 환경에서는 사용할 수 없습니다.&#x20;
{% endhint %}

## OAuth 로그인 제공자 설정 <a href="#oauth-login-provider-setup" id="oauth-login-provider-setup"></a>

OAuth 로그인 기능(예: `loginWithOauthProvider`)을 사용하려면 OAuth 로그인 제공자를 설정해야 합니다. 이를 위해 [Wepin Workspace](https://workspace.wepin.io/)에 OAuth 로그인 제공자 정보를 먼저 등록해야 합니다. Wepin Workspace의 Developer Tools 메뉴에서 Login 탭으로 이동한 후, Login Provider 섹션에서 App 또는 Set Login Provider 버튼을 클릭하여 등록을 완료하세요.

## 설치하기 <a href="#installation" id="installation"></a>

Wepin Compose Multiplatform Login Library 는 Maven Central 에 배포되어 있으며, build.gradle 에 dependency를 추가하여 설치할 수 있습니다. build.gradle.kt 의 commonMain dependency에 `wepin-compose-sdk-login-v1` 를 추가합니다.

```gradle
val commonMain by getting { 
    api("io.wepin:wepin-compose-sdk-login-v1:0.0.11") 
}
```

**iOS**

iOS 종속 라이브러리는 CocoaPods를 사용해 설치해야 합니다.

1. build.gradle 파일에 cocoapods plugin 을 추가하고 AppAuth, secp256k1, JFBCrypt 라이브러리  정보를 입력한 후 "Synk Project with Gradle Files" 를 클릭하면 shared.podspec 파일이 생성됩니다.
2. iosApp 폴더 내에 Podfile 을 추가합니다.
   1. Podfile 에 최소 iOS 버전을 13.0으로 설정해줘야 합니다.

```gradle
//build.gradle.kt(shared)
plugins {
    kotlin("native.cocoapods")
}

kotlin {
    cocoapods {
        summary = "Some description for a Kotlin/Native module"
        homepage = "Link to a Kotlin/Native module homepage"
        ios.deploymentTarget = "13.0"
        version = "0.0.1"

        pod("AppAuth") {
            version = "~> 1.7.5"
        }

        pod("secp256k1") {
            version = "~> 0.1.0"
        }

        pod("JFBCrypt") {
            version = "~> 0.1"
        }
    }
}
```

```swift
// Podfile
post_install do |installer|
    installer.generated_projects.each do |project|
        project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
            end
        end
    end
end
```

## 설정하기 <a href="#configuration" id="configuration"></a>

### Deep Link 설정  <a href="#deep-link-configuration" id="deep-link-configuration"></a>

OAuth 로그인 기능(`loginWithOauthProvider`)을 활성화하려면 Deep Link 스킴을 설정해야 합니다.

* Deep Link scheme format : `wepin. + Wepin 앱 ID`

**Android**

* `build.gradle (app)` 파일에서 `manifestPlaceholders`를 추가하여 Wepin Widget SDK가 이 커스텀 스킴을 통한 모든 리디렉션을 쉽게 캡처할 수 있도록 설정합니다.

{% code title="build.gradle(app)" %}

```gradle
// Deep Link 설정 => 리디렉션 스킴 형식: wepin. + Wepin 앱 ID
android.defaultConfig.manifestPlaceholders = [
  'appAuthRedirectScheme': 'wepin.{{YOUR_WEPIN_APPID}}'
]
```

{% endcode %}

```xml
AndroidManifest.xml
<activity
      android:name="com.wepin.android.loginlib.RedirectUriReceiverActivity"
      android:exported="true">
      <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:host="oauth2redirect"
              android:scheme="${appAuthRedirectScheme}" />
      </intent-filter>
</activity>
```

**iOS**

* 인증 프로세스 후 앱으로 다시 리디렉션하기 위해 앱의 URL 스킴을 `Info.plist` 파일에 추가해야 합니다.&#x20;

<pre class="language-xml" data-title="Info.plist"><code class="lang-xml"><strong>&#x3C;key>CFBundleURLTypes&#x3C;/key>
</strong>&#x3C;array>
    &#x3C;dict>
        &#x3C;key>CFBundleURLName&#x3C;/key>
        &#x3C;string>unique name&#x3C;/string>
        &#x3C;key>CFBundleURLSchemes&#x3C;/key>
        &#x3C;array>
            &#x3C;string>wepin.{{YOUR_WEPIN_APPID}}&#x3C;/string>
        &#x3C;/array>
    &#x3C;/dict>
&#x3C;/array>
</code></pre>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wepin.io/widget-integration/compose-multiplatform-sdk/login-library/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
