I am not sure whether platform.session.user will be available for the first time registration? Correct me if i am wrong because I tried to get the user id using platform.api.get("user/session").user_id but it says "There is no valid session token"
One curious thing I have noticed is a POST request made directly to "system/user" with "user_to_app_to_role_by_user_id" : { "app_id": 1, "role_id": 1} in the user details payload is working perfectly fine and the user is being created with exact assignment of roles.
This whole system/user and user/register is quite confusing to me and I am not sure which one to use.