I try to authorize Azure AD guest users to my web application through the MSAL library. Since it is an SPA, I'm using implicit grant flow. For "standard" users, the flow is OK. But for "guest" users (with personal addresses like "gmail"), it fails on getting obo token as described here :
Message is :
{ "error": "invalid_grant",
"error_description": "AADSTS500341: The user account <user_account> has been deleted from the <tenantId> directory. To sign into this application, the account must be added to the directory.
}
I isolated the http request to bypass MSAL magic (it fails on /oauth2/token request):
I just wonder if guest users could be authorized with this flow or if there is another way to authorize them.
When using On-Behalf-Of flow, please follow the steps here. If requesting
/token
endpoint with id_token, it will return this error. Theassertion
should set with access token.You use the On-Behalf-Of flow but not implicit grant flow in your issue.
Try to follow the steps with an invited user using implicit flow:
https://learn.microsoft.com/en-us/azure/active-directory/external-identities/b2b-quickstart-add-guest-users-portal#add-a-new-guest-user-in-azure-ad
/authorize
for tokenYou could login the user at the browser using the implicit flow.
My test result: