diff --git a/LearningHub.Nhs.WebUI/Controllers/OpenAthensController.cs b/LearningHub.Nhs.WebUI/Controllers/OpenAthensController.cs index 31fac8cb2..f046d8680 100644 --- a/LearningHub.Nhs.WebUI/Controllers/OpenAthensController.cs +++ b/LearningHub.Nhs.WebUI/Controllers/OpenAthensController.cs @@ -235,6 +235,11 @@ public ActionResult Login(string returnUrl, bool invalidScope = false) return this.View(); } + if (string.IsNullOrWhiteSpace(this.authConfig.ClientId) || string.IsNullOrWhiteSpace(this.Settings.LearningHubWebUiUrl)) + { + throw new Exception("ClientId or origin are empty."); + } + var authUri = OpenAthensOpenIdConnect.GetAuthServerUri(this.authConfig, this.Settings, returnUrl); return this.Redirect(authUri.AbsoluteUri);