cancel
Showing results for 
Search instead for 
Did you mean: 

using JWTAuthInterceptor in Nuxeo Java Client

Ghazi_HAKIM
Confirmed Champ
Confirmed Champ

Hello,

I finally succeeded to use Keycloak as a identity provider for my Nuxeo using the openid package. I can now connect using JWT Token generated by Keycloak and get all my user infos even groups ! Now I am trying to use Nuxeo Java Client to do the same thing. Here is my code :

NuxeoClient nuxeoClient = new NuxeoClient .Builder() .url(url) .connectTimeout(connectTimeout) .readTimeout(readTimeout) .interceptor(new JWTAuthInterceptor(token)) .authentication(new JWTAuthInterceptor(token)) .schemas("*") .connect();

But I am always getting errors (401 not authorized).

Did I forget something ?

I am using Nuxeo LTS 2021 / Nuxeo Java Client 3.11.0 / Keycloak 19.0.1 / JDK 11.

Regards.

3 REPLIES 3

Ghazi_HAKIM
Confirmed Champ
Confirmed Champ

Hello [Kevin Leturc](https

Kevin_Leturc
Star Contributor
Star Contributor

Hello,

I'm not sure the JWTAuthInterceptor is working with the Keycloak provider. The interceptor works with the JWT secret configured on Nuxeo side, see https://doc.nuxeo.com/client-java/3.11/authentication/#jwt-authentication

Maybe you need to create your own interceptor for this use case, how do you succeed to authenticate with a Keycloak token, do you have a curl command example?

Thanks

Thank you [Kevin Leturc](https

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.