How to set dynamic Redirect URI for App Registration in Azure in order to use OneDrive FilePicker API to open files from webapp
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: 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)
Here is the error- If the webapplication url doesn't match with Redirect URI,
"invalid_request: The provided value for the input parameter 'redirect_uri' is not valid. The expected value is a URI which matches a redirect URI registered for this client application."
Sign in to comment
@Amit Singla Redirect URIs seems only support static URI. We can work with files in Microsoft Graph.