From 6c26f7b2cc3061ddb09ce2fc5d58808528260e88 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Tue, 13 Jul 2021 15:58:08 -0400 Subject: [PATCH] Fix a bug, and improve an error message (#24) --- Project.toml | 2 +- src/provider/ehr_launch.jl | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index d459d37..e65862d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SMARTAppLaunch" uuid = "d2818e16-7729-416e-a683-becc19f3d01b" authors = ["Dilum Aluthge", "contributors"] -version = "1.1.0" +version = "1.1.1" [deps] HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" diff --git a/src/provider/ehr_launch.jl b/src/provider/ehr_launch.jl index 9100581..795b400 100644 --- a/src/provider/ehr_launch.jl +++ b/src/provider/ehr_launch.jl @@ -21,7 +21,7 @@ end """ function provider_ehr_launch(config::ProviderEHRLaunchConfig, uri::URIs.URI; - scope::AbstractString = _default_scope) + kwargs...) queryparams = URIs.queryparams(uri)::Dict{String, String} return provider_ehr_launch(config, queryparams; kwargs...) end @@ -84,6 +84,12 @@ function provider_ehr_launch(config::ProviderEHRLaunchConfig; redirect = false, ) headers = Dict(authorize_response.headers) + auth_error_msg = string( + "Something when wrong when authenticating to the EHR. ", + "One possible explanation is that your `redirect_uri` value does not exactly ", + "match any of the `redirect_uri` values that are on file with the EHR.", + ) + haskey(headers, "Location") || @error(auth_error_msg) location = headers["Location"] location_uri = URIs.URI(location) location_queryparams = URIs.queryparams(location_uri)