java - Vertx OAuth2 Error on Authentification " invalid_grant: Incorrect redirect_uri" - Stack Overflow

admin2025-04-18  4

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.

转载请注明原文地址:http://anycun.com/QandA/1744953621a89962.html