# Authentication for IFrame

**URL:** <https://community.hubspot.com/t/authentication-for-iframe/117493>\
**Category:** APIs & Integrations\
**Tags:** oauth\
**Created:** [October 2, 2024, 5:35am UTC](https://community.hubspot.com/t/authentication-for-iframe/117493 "2024-10-02T05:35:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PRossner](https://avatars.discourse-cdn.com/v4/letter/p/47e85d/32.png) [@PRossner](https://community.hubspot.com/u/PRossner)\
**Post date:** [October 2, 2024, 5:35am UTC](https://community.hubspot.com/t/authentication-for-iframe/117493/1 "2024-10-02T05:35:33Z")

</div>

We try to embed our staff backoffice which has AzureAD/Entra as OAuth2 identity provider implemented. The same provider is configured as SAML SSO for HubSpot. Still, when an Iframe is being loaded on a modal from a CRM-Card, the iframe tries to redirect to [login.microsoft.com](http://login.microsoft.com), which causes an error because it can not be loaded on a framed page.

1. Why is there a redirect when the users Identity is the same as for HubSpot?

2. How can we secure the content of a IFrame at all with this kind of behavior?

Are WebComponents an option to this issue?

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [October 3, 2024, 3:10pm UTC](https://community.hubspot.com/t/authentication-for-iframe/117493/2 "2024-10-03T15:10:42Z")

</div>

Hey, [@PRößner](https://community.hubspot.com/t5/user/viewprofilepage/user-id/779605) 👋 Thanks for your questions.

Given the complexity of securing iframes and handling cross-domain authentication between OAuth2 and SAML, this may require a more advanced solution. Due to the technical challenges involved, I’d recommend working with a consultant or dedicated resources familiar with these systems to implement a secure solution. One option is to reach out to a [**Solutions Partner**](https://ecosystem.hubspot.com/marketplace/solutions), but you are welcome to use any technical resource that is a good fit for your needs.

Best,

Jaycee
