From 462ed838019bd3e35532f3a4ba39efc8c807b367 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Ferreira Figueiredo Date: Mon, 23 Jun 2025 10:17:54 -0300 Subject: [PATCH] fix: adds missing HTTP Header to be used in the code-to-token request. Fixes https://github.com/vapor-community/Imperial/issues/80 --- Sources/ImperialKeycloak/KeycloakRouter.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/ImperialKeycloak/KeycloakRouter.swift b/Sources/ImperialKeycloak/KeycloakRouter.swift index af1c96ef..76794dcc 100644 --- a/Sources/ImperialKeycloak/KeycloakRouter.swift +++ b/Sources/ImperialKeycloak/KeycloakRouter.swift @@ -23,6 +23,10 @@ struct KeycloakRouter: FederatedServiceRouter { self.accessTokenURL = keycloakTokens.accessTokenURL } + var callbackHeaders: HTTPHeaders { + .init([("Content-Type", "application/x-www-form-urlencoded")]) + } + func authURL(_ request: Request) throws -> String { return "\(self.authURL)/auth?" + "client_id=\(self.tokens.clientID)&"