Hi all,
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)))
)
I then 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 I get back a 400 from the external endpoint, so it seems that I’m doing something wrong in the way I am building the request. Any tips?