I'm trying to make a HTTP Request using Java 11 HttpClient and after receiving an access token I'm getting a 403 error.
Here's a coding snippet, after receiving a valid token:
HttpClient httpClient = HttpClient.newBuilder().build();
String endpoint = "https://oauth.reddit.com/api/v1/me/trophies";
HttpRequest request = HttpRequest.newBuilder().uri(new URI(endpoint))
.header("Authorization", "bearer" + token)
.build();
This produces a 403 forbidden, but doing the same request in Postman and setting the headers for Authorization as bearer + the token received results in the request passing.
What am I doing wrong here?