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}