Hello @JangidHimani-9673
Thank you for taking the time to gather those details as well as your patience.
I hope this time I am following the whole scenario and if not, please forgive me in advance : )
Having said that, I want to bring some details back and also, to double check few things too. So, let me start by mentioning this below:
I have read one more time the whole thread post and besides that, the GITHUB link in order to not miss any relevant detail. For instance, On the link stated several times, we can find the next URL's.
1- First link from this post >>>> https://github.com/Azure-Samples/ms-identity-java-desktop/tree/master/
2- For JAVA WebAPPs : https://github.com/Azure-Samples/ms-identity-java-webapp
3- For JAVA desktop applications: https://github.com/Azure-Samples/ms-identity-java-desktop/
- Furthermore, there is a relevant note that i just wanted to share in case you either missed or confirm that you did follow the instruction provided.
Once this app is configured as multitenant, users from other tenants would be able to access this app and authenticate to it using their tenant user IDs. Once the users from other tenant signs into this app, a service principal for this app would get created in their tenant and then on that service principal you can apply the RBAC roles. For the user authentication, it would reach out to that other tenant and fetch a token from that other tenant when the user of that tenant puts in the creds.
Points to note:
In your current application's code, where you have mentioned the authority like "https://login.microsoftonline.com/{tenant-id}" you need to modify that and put in the following "https://login.microsoft.com/common". If you are following the same sample that I have shared with you above, you would that that sample has the following variable defined: " private final static String AUTHORITY = "https://login.microsoftonline.com/common/" " in the UsernamePasswordFlow.java. This is required for the application code to behave has multitenant.
Then, it is Windows or Linux OS being used... Could you confirm it please?
Finally, did you test it using different user/UPN or OS device? and same result?
Looking forward to your feedback,
Cheers,
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.