I have an Azure Active Directory and a SPA App registration.
I am using the Microsoft Graph endpoint to invite a Guest User to the AD.
Graph Invite Api
Doc followed - https://docs.microsoft.com/en-us/graph/api/invitation-post?view=graph-rest-1.0&tabs=http
request URL - https://graph.microsoft.com/v1.0/invitations (POST request)
request BODY -
{
invitedUserDisplayName: "John Doe",
invitedUserEmailAddress: "[email protected]",
inviteRedirectUrl: "https://example.com",
"sendInvitationMessage": true,
"invitedUserMessageInfo": {
"customizedMessageBody": ""
}
}
This sends an AAD invitation at invitedUserEmailAddress and a redemption link in the mail. (This also adds a guest user entry to the list of users in my AAD with invitation status as pending acceptance)
Now if the user clicks on the redemption link in their mail, they are successfully redirected to inviteRedirectUrl (Invitation status for the user changes from pending acceptance to Accepted in AAD)
My problem - But if a user tries to SignIn directly to https://portal.azure.com or my SPA (without/before accepting the invitation sent to their Email) they are prompted "Review Permissions" page for getting added to AAD but after that they are not redirected to inviteRedirectUrl.
I am tracking the status of the user's invitation status using inviteRedirectUrl (changing the invite status when inviteRedirectUrl is called), which I am unable to do if the user directly tries to SignIn to my SPA.
Is this the desired behavior to not call inviteRedirectUrl if someone tries to sign in directly or can this be remediated somehow?