I get this error when I’m trying to make an appointment
{ “id”: “mosip.pre-registration.booking.book”, “version”: “1.0”, “responsetime”: “2025-11-14T10:11:26.918Z”, “response”: null, “errors”: [ { “errorCode”: “PRG_APP_015”, “message”: “Requested application id does not belong to the user” } ] }
i investigated the code and i found the problem here
private void userValidation(ApplicationEntity applicationEntity) {
String authUserId = authUserDetails().getUserId();
List<String> list = listAuth(authUserDetails().getAuthorities());
if (list.contains("ROLE_INDIVIDUAL")) {
log.info("sessionId", "idType", "id", "In userValidation method of ApplicationService with applicationId "
+ applicationEntity.getApplicationId() + " and userID " + authUserId);
if (!authUserDetails().getUserId().trim().equals(applicationEntity.getCrBy().trim())) {
throw new PreIdInvalidForUserIdException(ApplicationErrorCodes.PRG_APP_015.getCode(),
ApplicationErrorMessages.INVALID_APPLICATION_ID_FOR_USER.getMessage());
}
}
}
I see that it tries to compare the email of who created the application and the userId from authUserDeatails which is the data from the token comming form keycloack.
is there any speceific configuaration to pass this part
I had a look at your question and at the official MOSIP 1.2.0 documentation for Pre-Registration features.
In the standard MOSIP Pre-Registration flow, there is no Keycloak-based login for end residents on the Pre-Registration side. Pre-Registration uses its own authentication mechanism based on email/mobile + OTP, allowing the resident to create and manage their pre-registration applications:
Login and Pre-Registration are done using an email address or mobile number with OTP.
Each application (PRID) is created under the authenticated user account.
Because of this, the expected functional behavior in userValidation() is:
The user who books the appointment must be the same user who originally created the pre-registration application.
This is why the code compares:
authUserDetails().getUserId() → the currently authenticated user
applicationEntity.getCrBy() → the user who created the application
and throws PRG_APP_015 when they do not match.
To confirm this, you can:
Log in to the Pre-Registration UI using the same email/phone that was used to create the original pre-registration application, and then try booking again.
Hope this clarifies why you are seeing PRG_APP_015 and how to test it with the correct user.