Skip to content

Latest commit

 

History

History
312 lines (261 loc) · 14.9 KB

MIGRATION_GUIDE_UP_TO_VERSION_2.md

File metadata and controls

312 lines (261 loc) · 14.9 KB

New requirements

  • Minimum Android 6.0 (API level 23) is now required (previously Android 5.0, API level 21).
  • Minimum Android Studio version is Flamingo 2022.2.1 (previously Android Studio Dolphin 2021.3.1).

Dependencies update

  • Maven Central

Tink dependency definition in Maven Central has changed.

  1. In your build.gradle product module file replace:
dependencies {
    implementation 'com.tink:link-ui:0.16.0'
}

With:

dependencies {
    implementation 'com.tink:link:2+'
}
  1. Sync the changes.

Styling

There's no need to define a style resource file (e.g., sample version prior 2.0). Styling is now defined via the type-conforming TinkAppearance protocol.

Android Manifest

  • Previous activity definition with Tink Link Android version prior 2.0:
<activity
      android:name="com.tink.link.ui.TinkLinkUiActivity"
      android:exported="false"
      android:launchMode="singleTask">
</activity>
  • New activity definition with Tink Link 2.0:
<activity
    ...
    android:exported="true"
    android:launchMode="singleInstance">
    <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="YOUR_REDIRECT_URL_HOST"
                android:scheme="YOUR_REDIRECT_URL_SCHEME" />
    </intent-filter>
</activity>

Configuration

  • Previous implementation with Tink Link Android version prior 2.0:
val configuration = TinkConfiguration(
                    environment = Environment.Production,
                    oAuthClientId = "YOUR_CLIENT_ID",
                    redirectUri = Uri.parse("YOUR_REDIRECT_URI")
)
Tink.init(configuration, applicationContext)
  • New implementation with Tink Link 2.0:
val configuration = Configuration(
                    clientId = "YOUR_CLIENT_ID",
                    redirectUri = "YOUR_REDIRECT_URI"
)

Response handling

No more need to define onActivityResult handler (e.g., sample version prior 2.0). A resulting callback handler is now required during the product initialization step. (e.g., TinkAccountAggregation/authorizeForOneTimeAccess).

Declaration changes

  1. Tink.init call is removed. Tink class now used for access product flows only.

  2. TinkConfiguration class is removed. Use Configuration class.

  3. Environment is removed.

  4. LinkUser is removed. User Market class to define market.

  5. ProviderSelection class is removed. Use flow request class to define provider (e.g., AuthorizeForOneTimeAccess)

  6. Scope class is removed. Use flow dedicated request class (e.g., AuthorizeForOneTimeAccess) to provide list of Scope enums.

  7. CredentialsOperation class is removed. Use dedicated flow class (e.g., TinkAccountAggregation) to call operations.

  8. TinkLinkUiActivity class is removed. It is no longer needed to start activity manually. To present product flow you need to call preferred one from product class (e.g., TinkAccountAggregation.authorizeForOneTimeAccess).

  9. TinkLinkError class is removed. Utilize TinkError instead.

  10. TinkLinkResult class is removed. Utilize product dedicated success class instead (e.g., TinkAccountAggregationSuccess in case of TinkAccountAggregation product).

Account Aggregation product migration guide

  • Previous implementation with Tink Link Android version prior 2.0:
val linkUser = createdUser()?.let { LinkUser.ExistingUser(it) }
                ?: authorizationCode()?.let { LinkUser.UnauthenticatedUser(it) }
                ?: LinkUser.TemporaryUser(market = "SE", locale = "sv_SE")

startActivityForResult(
                TinkLinkUiActivity.createIntent(
                    context = this,
                    linkUser = linkUser,
                    scopes = listOf(Scope.AccountsRead),
                    styleResId = R.style.TinkLinkUiStyle,
                    credentialsOperation = CredentialsOperation.Create(ProviderSelection.ProviderList())
                ),
                REQUEST_CODE
            )
  • New implementation with Tink Link 2.0:
val configuration = Configuration(
            clientId = "YOUR_CLIENT_ID",
            redirectUri = "YOUR_REDIRECT_URI"
)

val authorizationCode = "YOUR_AUTHORIZATION_CODE"
val request = AddCredentials(
    authorizationCode = authorizationCode,
    market = "SE",
    scope = listOf(
        Scope.USER_CREATE,
        Scope.AUTHORIZATION_GRANT)
)

val appearance = makeMyTinkAppearance()
val launchMode = Modal(appearance)

Tink.AccountAggregation.addCredentials(
    activity = this,
    configuration = configuration,
    request = request,
    launchMode = launchMode,
    onSuccess = { success: TinkAccountAggregationSuccess ->
        Log.d("permanentAddCredentials", "SUCCESS")
    },
    onError = { error: TinkError ->
        Log.d("permanentAddCredentials", "ERROR")
    }
)
  • Previous implementation with Tink Link Android version prior 2.0:
 val linkUser = createdUser()?.let { LinkUser.ExistingUser(it) }
                ?: authorizationCode()?.let { LinkUser.UnauthenticatedUser(it) }
                ?: LinkUser.TemporaryUser(market = "SE", locale = "sv_SE")

 startActivityForResult(
                TinkLinkUiActivity.createIntent(
                    context = this,
                    linkUser = linkUser,
                    scopes = listOf(Scope.AccountsRead),
                    styleResId = R.style.TinkLinkUiStyle,
                    credentialsOperation = CredentialsOperation.Authenticate(credentialsId = "YOUR_CREDENTIALS_ID")
                ),
                REQUEST_CODE
            )
  • New implementation with Tink Link 2.0:
val configuration = Configuration(
            clientId = "YOUR_CLIENT_ID",
            redirectUri = "YOUR_REDIRECT_URI"
)

val authorizationCode = "YOUR_AUTHORIZATION_CODE"
val credentialsId = "YOUR_CREDENTIALS_ID"
val request = AuthenticateCredentials(
    authorizationCode = authorizationCode,
    credentialsId = credentialsId,
    market = "SE"
)

val appearance = makeMyTinkAppearance()
val launchMode = Modal(appearance)

Tink.AccountAggregation.authenticateCredentials(
    activity = this,
    configuration = configuration,
    request = request,
    launchMode = launchMode,
    onSuccess = { success: TinkAccountAggregationSuccess ->
        Log.d("permanentAuthenticateCredentials", "SUCCESS")
    },
    onError = { error: TinkError ->
        Log.d("permanentAuthenticateCredentials", "ERROR")
    }
)
  • Previous implementation with Tink Link Android version prior 2.0:
 val linkUser = createdUser()?.let { LinkUser.ExistingUser(it) }
                ?: authorizationCode()?.let { LinkUser.UnauthenticatedUser(it) }
                ?: LinkUser.TemporaryUser(market = "SE", locale = "sv_SE")

 startActivityForResult(
                TinkLinkUiActivity.createIntent(
                    context = this,
                    linkUser = linkUser,
                    scopes = listOf(Scope.AccountsRead),
                    styleResId = R.style.TinkLinkUiStyle,
                    credentialsOperation = CredentialsOperation.Refresh(credentialsId = "YOUR_CREDENTIALS_ID")
                ),
                REQUEST_CODE
            )
  • New implementation with Tink Link 2.0:
val configuration = Configuration(
            clientId = "YOUR_CLIENT_ID",
            redirectUri = "YOUR_REDIRECT_URI"
)

val authorizationCode = "YOUR_AUTHORIZATION_CODE"
val credentialsId = "YOUR_CREDENTIALS_ID"
val request = RefreshCredentials(
    authorizationCode = authorizationCode,
    credentialsId = credentialsId,
    market = "SE",
    authenticate = true
)

val appearance = makeMyTinkAppearance()
val launchMode = Modal(appearance)

Tink.AccountAggregation.refreshCredentials(
    activity = this,
    configuration = configuration,
    request = request,
    launchMode = launchMode,
    onSuccess = { success: TinkAccountAggregationSuccess ->
        Log.d("permanentRefreshCredentials", "SUCCESS")
    },
    onError = { error: TinkError ->
        Log.d("permanentRefreshCredentials", "ERROR")
    }
)

4. Permanent user aggregation: Update

Call is not available in Tink Link 2.0. Use Extend consent instead.

  • Previous implementation with Tink Link Android version prior 2.0:
val linkUser = createdUser()?.let { LinkUser.ExistingUser(it) }
                ?: authorizationCode()?.let { LinkUser.UnauthenticatedUser(it) }
                ?: LinkUser.TemporaryUser(market = "SE", locale = "sv_SE")

 startActivityForResult(
                TinkLinkUiActivity.createIntent(
                    context = this,
                    linkUser = linkUser,
                    scopes = listOf(Scope.AccountsRead),
                    styleResId = R.style.TinkLinkUiStyle,
                    credentialsOperation = CredentialsOperation.Update(credentialsId = "YOUR_CREDENTIALS_ID")
                ),
                REQUEST_CODE
            )

  • New implementation with Tink Link 2.0:
val configuration = Configuration(
            clientId = "YOUR_CLIENT_ID",
            redirectUri = "YOUR_REDIRECT_URI"
)

val market = "SE"
val request = ExtendConsent(
    authorizationCode = "YOUR_AUTHORIZATION_CODE",
    credentialsId = "YOUR_CREDENTIALS_ID",
    market = market
)

val appearance = makeMyTinkAppearance()
val launchMode = Modal(appearance)

Tink.AccountAggregation.extendConsent(
    activity = this,
    configuration = configuration,
    request = request,
    launchMode = launchMode,
    onSuccess = { success: TinkAccountAggregationSuccess ->
        Log.d("permanentExtendConsent", "SUCCESS")
    },
    onError = { error: TinkError ->
        Log.d("permanentExtendConsent", "ERROR")
    }
)