question

shehrazkhan-0900 avatar image
0 Votes"
shehrazkhan-0900 asked sikumars commented

Getting 401 UNAUTHORIZED in mutitenant app

I am using azure multitenant app and trying the other azure user to signin to my web application via signin with micorosoft account.
Users are able to launch signin consent but when it redirects to my application redirect uri, it always saying 401 unauthorised.

2021-10-28 03:33:55.394 DEBUG 26156 --- [nio-9090-exec-3] o.s.web.client.RestTemplate : HTTP POST https://login.microsoftonline.com/common/oauth2/token
2021-10-28 03:33:55.395 DEBUG 26156 --- [nio-9090-exec-3] o.s.web.client.RestTemplate : Accept=[application/json, application/*+json]
2021-10-28 03:33:55.397 DEBUG 26156 --- [nio-9090-exec-3] o.s.web.client.RestTemplate : Writing [{grant_type=[authorization_code], code=[0.AX0Avfa0C4c4bUmPRxXR6h9AoAxUGdqY4PpEjJQIhC26Y998AAA.AQABAAIAAAD--DLA3VO7QrddgJg7Wevry1umSuzIWCf52U9], redirect_uri=[https://localhost:9090/sso/login/oauth2/code/azure]}] as "application/x-www-form-urlencoded;charset=UTF-8"
2021-10-28 03:33:56.195 DEBUG 26156 --- [nio-9090-exec-3] o.s.web.client.RestTemplate : Response 401 UNAUTHORIZED

I have gone through documentation but couldn't find the solution.

azure-active-directory
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@shehrazkhan-0900,

I just wanted to check in and see if you had any other questions or if you were able to resolve this issue? If you have any other questions, please let us know. Thank you for your time and patience throughout this issue.


Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

0 Votes 0 ·

1 Answer

michev avatar image
1 Vote"
michev answered

Multi-tenant only covers Office 365/commercial accounts, in order to be able to login with Microsoft account (consumer account) you need to select the "Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)" or "Personal Microsoft accounts only" values.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.