Facebook seems to answer some API calls with text/plain instead of application/json. The oauth endpoint https://graph.facebook.com/oauth/access_token is one example. This seems to confuse the vert.x oauth client implementation. This is the call that fails:
oauth2.getToken(new JsonObject()
.put("code", code)
.put("redirect_uri", callbackUrl),
res -> {
if (res.failed()) {
logger.warn(res.cause().getMessage());
} else {
AccessToken = res.result();
// ...etc...
}
The logged message is: Cannot handle content type: text/plain
So my question is, apart from the obvious solution of implementing my own getToken()
method just for the Facebook provider, is there any other way to make the implementation parse the plain text response? It is a simple url encoded string like access_token=foo&expires=5179336
Is there a way to make Facebook answer in JSON that I am not aware of?