Okay so my goal was to integrate google and microsoft with aws cognito to give allow users to signup/signin using their google and microsoft accounts. The google one works perfectly but since there was no Microsoft integration in aws natively I followed various tutorials.
I ended up creating a OpenID Connect (OIDC) identity provider in the cognito pool and in Azure portal i created a directory from which i mapped the following to the OIDC i created:
Application (client) ID
Client Secret
Issuer URL:**
https://login.microsoftonline.com/{tenant}/v2.0
**
and scopes of
**openid profile email
and set attribute request method as post
**
In my react application i am using:
await Auth.federatedSignIn({ provider: 'Microsoft' });
and my redirect url in the auth in azure is
https://{{my cognito pool domain}}/oauth2/idpresponse
now this works perfectly for a user that exists in azure AD and it allows the entire flow to completes creates a user in cognito with external provider but it doesn’t work for any other microsoft email except for the ones that are users in azure AD and i get the error
AADSTS50020: User account '{{email}}' from identity provider 'live.com' does not exist in tenant '{{Azure app name}}' and cannot access the application '{{application id}} in that tenant. The account needs to be added as an external user in the tenant first. Sign out and sign in again with a different Azure Active Directory user account.
I want to create something that allows every Microsoft user even if they don’t exist in AD to signup using microsoft and use my react app
What can i do and what am i doing wrong? Can anyone please help me on this?