I’m receiving a warning from akka http when trying to make a POST request with a bearer token.
Here is the snippet where I am making the request.
val bearerToken: String = "..."
val resp = Http(context.system)
.singleRequest(
HttpRequest(
HttpMethods.POST,
endpoint,
entity = HttpEntity(MediaTypes.`application/json`, payloadJson)
).withHeaders(Authorization(OAuth2BearerToken(bearerToken)))
)
Then I see this in the log:
WARN akka.actor.ActorSystemImpl - Illegal header: Illegal ‘authorization’ header: Invalid input ‘2’, expected ‘=’, OWS or ‘EOI’ (line 1, column 1152): Bearer token-string-here
And the external endpoint is returning a 400, so it seems I'm doing something wrong in constructing the request. Any tips?