Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accessToken / refreshToken only not working with ConnectorType.TPP_TOKEN #123

Open
KumarKai opened this issue Sep 30, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@KumarKai
Copy link

The following code is failing:

//Create an Authentication object with the access token
final Authentication auth = Authentication.builder()
        .accessToken("9PQwQeiTLhcB8/W3/z2Lbw==")
        .build();

//Create a Config object setting the Authentication object
final Config config = Config.builder()
        .connectorType(ConnectorType.TPP_TOKEN)
        .baseUrl("https://tpp.venafi.example")
        .credentials(auth)
        .build();
//Create the client with the Config object. The client will be authenticated
final VCertTknClient client = new VCertTknClient(config);

Error:
Exception in thread "main" com.venafi.vcert.sdk.VCertException: feign.FeignException$Unauthorized: status 401 reading TppToken#verifyToken(String)
at com.venafi.vcert.sdk.VCertException.fromFeignException(VCertException.java:57)
at com.venafi.vcert.sdk.connectors.tpp.TppTokenConnector.verifyAccessToken(TppTokenConnector.java:98)
at com.venafi.vcert.sdk.connectors.tpp.TppTokenConnector.authorize(TppTokenConnector.java:70)
at com.venafi.vcert.sdk.connectors.Connector.authenticate(Connector.java:78)
at com.venafi.vcert.sdk.VCertClient.(VCertClient.java:40)
at com.venafi.vcert.sdk.VCertTknClient.(VCertTknClient.java:17)
at org.example.VenafiTest.main(VenafiTest.java:35)
Caused by: feign.FeignException$Unauthorized: status 401 reading TppToken#verifyToken(String)
at feign.FeignException.clientErrorStatus(FeignException.java:161)
at feign.FeignException.errorStatus(FeignException.java:141)
at feign.FeignException.errorStatus(FeignException.java:133)
at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:92)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:151)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:80)
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103)
at jdk.proxy2/jdk.proxy2.$Proxy5.verifyToken(Unknown Source)
at com.venafi.vcert.sdk.connectors.tpp.TppTokenConnector.verifyAccessToken(TppTokenConnector.java:96)
... 5 more

When adding usernamen and password to the Authentication object and ONLY when removing accessToken it works.
But this means, we can not persist the refreshtoken and re-use it. We always must revoke it after every "transaction"

@KumarKai KumarKai added the bug Something isn't working label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant