diff --git a/Sources/eudiWalletOidcIos/Service/VerificationService.swift b/Sources/eudiWalletOidcIos/Service/VerificationService.swift index a368739..ced041b 100644 --- a/Sources/eudiWalletOidcIos/Service/VerificationService.swift +++ b/Sources/eudiWalletOidcIos/Service/VerificationService.swift @@ -185,17 +185,21 @@ public class VerificationService: NSObject, VerificationServiceProtocol { } catch { presentationDefinition = nil } + //encoding is done because '+' was removed by the URL session + let formatKey = presentationDefinition?.format?.first(where: { key, _ in key.contains("vc") })?.key ?? "" + let format = formatKey == "vcsd-jwt" ? "vc+sd-jwt" : formatKey + let encodedFormat = format.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed.union(CharacterSet(charactersIn: "+")).subtracting(CharacterSet(charactersIn: "+")))?.replacingOccurrences(of: "+", with: "%2B") if let inputDescriptors = presentationDefinition?.inputDescriptors { for index in 0.. WrappedVerificationResponse? { @@ -229,9 +233,14 @@ public class VerificationService: NSObject, VerificationServiceProtocol { let httpres = response as? HTTPURLResponse - if httpres?.statusCode == 302, let location = httpres?.value(forHTTPHeaderField: "Location"){ - responseUrl = location - return WrappedVerificationResponse(data: responseUrl, error: nil) + + if httpres?.statusCode == 302 || httpres?.statusCode == 200 { + if let location = httpres?.value(forHTTPHeaderField: "Location") { + responseUrl = location + return WrappedVerificationResponse(data: responseUrl, error: nil) + } else { + return WrappedVerificationResponse(data: "https://www.example.com?code=1", error: nil) + } } else if httpres?.statusCode ?? 400 >= 400 { return WrappedVerificationResponse(data: nil, error: ErrorHandler.processError(data: data)) } else{