How to set dynamic Redirect URI for App Registration in Azure in order to use OneDrive FilePicker API to open files from webapp

Amit Singla 1 Reputation point
2021-07-01T19:56:03.013+00:00

Hello Azure OneDrive team,
I would like to use the OneDrive FilePicker in my web application, but the URL of our webapplication is pretty dynamic.
e.g. https://www.abcde.com/<domaincontext>/ab
This "domaincontext" could be anything.
As per the instructions provided by Onedrive: https://learn.microsoft.com/en-us/onedrive/developer/controls/file-pickers/js-v72/open-file?view=odsp-graph-online
We need to register the application on this App Registration page: https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
and one of the thing, we need to setup as part of registration is, "Authentication" and where in we need to configure "Redirect URIs".

While doing research and working on prototype of OneDrive FilePicker, I found that:
Redirect URI should be the exact match of the webapplication url.

But in our case, our webapplication url is dynamic as mentioned above.

If the webapplication url doesn't match with Redirect URI, then it throws error: " "

Please advise how to handle this ?

And also, there is another challenge we have been facing, was after getting access_token, how to pass the access_token to OneDrive API to bypass the authentication, as we are getting the access_token only after user's successful authentication.
Could you please provide some sample example on using FilePicker ?
(FYI: I have already followed the FIlePicker instructions provided here: https://learn.microsoft.com/en-us/onedrive/developer/controls/file-pickers/js-v72/open-file?view=odsp-graph-online
But these instructions are NOT helping out)

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,519 questions
{count} votes