I'm currently exchanging a custom oAuth2 implementation with the vertx OAuth2 library. I was following the guide on the Vertx Documentation for the code Flow.
Somehow at the end I get this error and I can't grasp what is wrong. I double checked and tried multiple things unsuccesfully.
At the end I still get this error:
invalid_grant: Incorrect redirect_uri
JsonObject config= new JsonObject();
tokenConfig.put("code", authCodeFromProvider);
tokenConfig.put("redirect_uri", redirectionUri);
oauth2.authenticate(tokenConfig).onSuccess(
reponse-> {
//CODE FOR Succesful Repsonse is here IS HERE
}
).onFailure(err -> {
//CODE FOR LOG IS HERE
});
Example from Vertx Doc.
// Redirect example using Vert.x
response.putHeader("Location", authorization_uri)
.setStatusCode(302)
.end();
JsonObject tokenConfig = new JsonObject()
.put("code", "<code>")
.put("redirectUri", "http://localhost:3000/callback");
// Callbacks
// Save the access token
oauth2.authenticate(tokenConfig)
.onSuccess(user -> {
// Get the access token object
// (the authorization code is given from the previous step).
})
.onFailure(err -> {
System.err.println("Access Token Error: " + err.getMessage());
});
Debugged the application, I tried to reconfigure the oauth provider visited blogs.