Skip to content

[Bug] Redirect URI from code app is too long to register in Entra ID, using MSAL #187

@stinenik

Description

@stinenik

Describe the bug

The new redirect URI when using MSAL in a code app has changed its pattern, and is over 256 characters long. This means that I can't register it in the app registration in Entra ID. Because of this, I can't sign in using MSAL in the app.

I am using MSAL to authenticate the user of the code app, to get a token to call the Dataverse API (the app was developed without using the build-in data souces of power apps). Earlier I have registered the redirect URI in the app registration in the Azure portal, and this was working fine a few weeks ago. When I pushed a new build to Power Apps, I got an error saying "The Redirect URI XXXX specified in the request does not match the redirect URIs configured for the application XXXX". Every time I pushed a new build, the redirect URI would change, and I would update it in the app registration. This worked fine.

With the new redirect URI using this pattern, it's too long to register in Entra ID:
https://[ID].4e.environment.api.powerplatformusercontent.com/powerapps/appruntime/[ID]/t/[ID]/storageproxy/[ID][DATE]t[TIME]/index.html

This was the old pattern:
https://[ID].weu.eu.powerapps.powerplatformusercontent.com/[DATE]t[TIME]/index.html

If there is another way to do this, and this isn't really a bug, please let me know.

Steps to Reproduce

  1. add MSAL to the app
  2. use pac code push to push the app to power apps
  3. register the app in Entra ID, add redirect URI from the error message when trying to log in

Expected behavior

I expected the new redirect URI to be shorter than 256 characters, so that it's possible to register it in the app registration in Entra.

Actual behavior

The new redirect URI is too long, over 256 characters.

Screenshots or Error Messages

Image Image

Environment information

  • Framework, build tool or relevant package used: React, Vite, MSAL, Dataverse Web API
  • Any connection/components: no

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions