[Bug] [Question] Unable to use MSAL browser auth (Graph API) in Code Apps — dynamic iframe URL prevents redirect URI registration #273
Replies: 2 comments 1 reply
-
|
@LeHailender - This is not something we support. The recommended approach is to use a custom connector. Custom connectors are supported today in code apps. Please give that a try and let us know if you have any questions |
Beta Was this translation helpful? Give feedback.
-
|
Hi everyone,
The Custom Connector is used exclusively to handle authenticated calls from the Code App to Power Automate Flows
The HTTP with Microsoft Entra ID (preauthorized) connector is used specifically to connect to SharePoint Online Call SharePoint REST APIs This works consistently in Web and Teams Desktop This separation made the overall solution much more robust and aligned with Power Platform security principles. I haven’t figured out how to configure multiple “HTTP with Microsoft Entra ID (preauthorized)” connections with different scopes If anyone has found a way to manage multiple preauthorized HTTP connections with different scopes, I’d be very interested to learn more. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
Power Apps Code Apps run inside a sandboxed iframe with a dynamic URL that changes on every deployment:
https://.environment.api.powerplatformusercontent.com/.../storageproxy//index.html
The storageproxy segment includes a timestamp (e.g., 20260318t164616z4f80d73c36) that changes with each pac code push. This makes it impossible to register a stable redirect URI in Azure AD App Registration for browser-based MSAL authentication flows.
Why this is a problem
Any Code App that needs to call Microsoft Graph API (e.g., SharePoint files, user photos, Teams presence) with delegated permissions requires browser-based MSAL authentication. Since no MSAL flow (redirect, popup, or custom window) can work with the dynamic iframe URL, Code Apps cannot authenticate to Graph API when running in Power Platform.
The same app works perfectly in local development (http://localhost:5173) because the URL is stable and can be registered.
What we tried
Expected behavior
Code Apps should provide one of the following:
Environment
Minimal reproduction
Beta Was this translation helpful? Give feedback.
All reactions