Issue
-
We have a Spring Boot extension client that interacts with the Liferay APIs and that makes the OAuth2 challenge via
-
OAuth2AccessToken oAuth2AccessToken = liferayOAuth2AccessTokenManager.getOAuth2AccessToken(clientRegistrationId);
-
When we launch the Spring Boot application via
bootRun
the OAuth2 Challenge is done without problem -
When we launch the Spring Boot application via
java -jar spring-boot-client-extension.jar
we receive this error: -
2024-09-05 15:12:40.482 DEBUG 80178 --- [main] : HTTP POST http://localhost:8080/o/oauth2/token
2024-09-05 15:12:40.483 DEBUG 80178 --- [main] : Accept=[application/json, application/*+json]
2024-09-05 15:12:40.484 DEBUG 80178 --- [main] : Writing [{grant_type=[client_credentials], client_id=[id-da997878-ba98-79d5-d494-9fa68e7daf0], client_secret=[<secret>]}] as "application/x-www-form-urlencoded;charset=UTF-8"
2024-09-05 15:12:40.492 DEBUG 80178 --- [main] : Response 401 UNAUTHORIZED
2024-09-05 15:12:40.499 ERROR 80178 --- [main] : Error during the import : [invalid_token_response] An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: 401 : [no body]
Environment
- Liferay SaaS Quarterly Release
- Liferay PaaS Quarterly Release
Resolution
-
Running the task via
bootRun
actually appends 2 environment variables which reference directories that contain the necessary information to the process. - SaaS: this is automated - nothing needs to be done.
- PaaS: there is a temporary documentation on how to implement this manually.