From e60f9ca9e361b3a00276da9a75ab56a6f009961b Mon Sep 17 00:00:00 2001 From: Georgi Christov <7644787+gchristov@users.noreply.github.com> Date: Wed, 24 May 2023 22:38:19 +0100 Subject: [PATCH] Fix OAuth without state (#79) --- .../gchristov/thecodinglove/slack/auth/SlackAuthApiService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/slack/src/jsMain/kotlin/com/gchristov/thecodinglove/slack/auth/SlackAuthApiService.kt b/backend/slack/src/jsMain/kotlin/com/gchristov/thecodinglove/slack/auth/SlackAuthApiService.kt index 46c47332..4cf4aa49 100644 --- a/backend/slack/src/jsMain/kotlin/com/gchristov/thecodinglove/slack/auth/SlackAuthApiService.kt +++ b/backend/slack/src/jsMain/kotlin/com/gchristov/thecodinglove/slack/auth/SlackAuthApiService.kt @@ -36,7 +36,7 @@ class SlackAuthApiService( response: ApiResponse ): Either { val code: String? = request.query["code"] - val state: String? = request.query["state"] + val state = request.query.get("state").takeIf { !it.isNullOrEmpty() } return slackAuthUseCase(code = code).flatMap { val stateResult = state?.let { handleAuthState(it) } ?: Either.Right(Unit) stateResult.flatMap {