MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.24k stars 21.4k forks source link

Sign in as Microsoft AzureAD Account #105811

Closed rick-hayek closed 1 year ago

rick-hayek commented 1 year ago

I have an SPA that hosts an iframe which references to a separated login page (login.html). The login page (login.html) simply redirects user to b2c login page which enables sign-in for both local account and social account (Microsoft Azure AD Account). When I try to sign in as social account, iframe fail to load page. console reports following error: Refused to display 'https://login.microsoftonline.com/' in a frame because it set 'X-Frame-Options' to 'deny'.

I've noticed the following comments from the doc:

Embedded sign-up or sign-in supports local accounts only. Most social identity providers (for example, Google and Facebook) block their sign-in pages from being rendered in inline frames.

Just want to double check if there's any place I can configure to enable this login.microsoftonline.com page being rendered in iframe, for example policy profile or identity provider application.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

AjayBathini-MSFT commented 1 year ago

@rick-hayek Thanks for your feedback! We will investigate and update as appropriate.

AjayBathini-MSFT commented 1 year ago

@rick-hayek Yes, you are correct. According to the fetched documents, most social identity providers block their sign-in pages from being rendered in inline frames.However, you can use a separate policy for social accounts, or you can use a single policy for both sign-in and sign-up with local and social accounts. Then you can use the domain_hint query string parameter. The domain hint parameter takes the user directly to the social identity provider's sign-in page.

Here is an example of how to use the domain_hint query string parameter in your code:

image

You can find more information about this in the following document: https://learn.microsoft.com/en-us/azure/active-directory-b2c/enable-authentication-spa-app-options