continueWithAuthCodeUrl

abstract fun continueWithAuthCodeUrl(authCodeUrl: String): Flow<CredentialDownloadEvent>

Second part of the process of downloading and saving credentials. Returns events and errors through the process of downloading and saving an previously offered com.youniqx.walletsdk.attestation.Attestation. After an external authorization via an URL returned in CredentialOfferEvent.OpenUrlForAuthEvent is finished, a URL containing an authorization token should be handed as deeplink to the app, see App Configuration for details.

Return

Flow of CredentialDownloadEvents

Example usage for Android:

suspend fun resumeOnAuthToken(intentData: String) {
walletSdk.attestations.continueWithAuthCodeUrl(intentData).collect { event ->
when (event) {
CredentialDownloadEvent.InvalidAppData,
CredentialDownloadEvent.ParsingError,
CredentialDownloadEvent.SavingError,
-> {
// handle error in the app
}
CredentialDownloadEvent.Success -> {
// show success in app
}
}
}
}

Example usage for iOS:

public func fetchCredential(withAuthCodeURL _url: URL) async throws(CredentialDownloadError) {
for await value in WalletSdk.shared.attestations.continueWithAuthCodeUrl(authCodeUrl: _url.relativeString) {
if let error = CredentialDownloadError.from(event: value) {
// handle error in the app
}
switch onEnum(of: value) {
case .success:
// Success, database should have triggered an update event, attestations will be updated
return
default:
// check if we are missing a new error code / event
// in CredentialDownloadError.from(event: value)
}
}
}

Parameters

authCodeUrl

an URL containing an authorization token.