Skip to content

Commit

Permalink
Fix #46: Handle error in process authorisation request
Browse files Browse the repository at this point in the history
  • Loading branch information
josmilan committed Jul 29, 2024
1 parent f8d1fed commit 4dba4ba
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ class IssueService : IssueServiceInterface {
"issuer_state" to (credentialOffer?.grants?.authorizationCode?.issuerState ?: "")
),
)

if (response?.code() == 502) {
throw Exception("Unexpected error. Please try again.")
}
val location: String? = if (response?.code() == 302) {
if (response.headers()["Location"]?.contains("error") == true || response.headers()["Location"]?.contains("error_description") == true) {
response.headers()["Location"]
Expand All @@ -214,9 +216,9 @@ class IssueService : IssueServiceInterface {
null
}

return if(Uri.parse(location).getQueryParameter("error") != null) {
return if(location != null && Uri.parse(location).getQueryParameter("error") != null) {
location
}else if (Uri.parse(location).getQueryParameter("code") != null
}else if (location != null && Uri.parse(location).getQueryParameter("code") != null
|| Uri.parse(location).getQueryParameter("presentation_definition") != null
) {
location
Expand Down

0 comments on commit 4dba4ba

Please sign in to comment.