1

I am using vertx to generate OAuth2 token with client credentials, Here is code snippet

<artifactId>vertx-auth-oauth2</artifactId>
<version>3.9.1</version>

OAuth2ClientOptions credentials = new OAuth2ClientOptions() .setClientID(clientId) .setClientSecret(clientSecret) .setFlow(OAuth2FlowType.CLIENT) .setTokenPath("oauth/token URL");

    OAuth2Auth oAuth2Auth = OAuth2Auth.create(Vertx.vertx(),credentials);
    JsonObject tokenConfig = new JsonObject();

    oAuth2Auth.authenticate(tokenConfig, res ->
            {
                if (res.failed()) {
                    log.info("Access Token Error;" + res.cause().getMessage());
                } else {
                    User token = res.result();
                    log.info("token:" + token);
                }
            }
    );

ERROR: Access Token Error;io/vertx/ext/jwt/NoSuchKeyIdException Stack Future{cause=io/vertx/ext/jwt/NoSuchKeyIdException}

1 Answers1

0

The configuration above is manually specifying the endpoints to the IdP server, and after a valid authentication the response included a JWT token as response. What vertx-auth-oauth2 is trying to do is parse this token, however no security keys have been loaded so it can't accept the token as valid.

It is expected to see this exception as a warning if there is not handler for the event, but it looks like you are getting the exception while parsing the token.

I suspect that this could be a bug, could you provide a simple example that reproduces the exception so I can further investigate?

Paulo Lopes
  • 5,845
  • 22
  • 31
  • Here is the code and you can add the dependency In order to replicate the issue. https://docs.google.com/document/d/13N4-yXyraihogSMIBVpzAa_jomIurr5GkF8fE88KEbs/edit?usp=sharing – Tech Support Jul 01 '20 at 16:15