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

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.
This "domaincontext" could be anything.
As per the instructions provided by Onedrive:
We need to register the application on this App Registration page:
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:
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,508 questions
{count} votes