JavaEar 专注于收集分享传播有价值的技术资料

OneDrive FilePicker "The provided value for the input parameter 'redirect_uri' is not valid"

I've spent a lot of time searching and trying to find a solution, so far without success.

I'm trying to implement a simple OneDrive filepicker as per

However I am continually getting the error'redirect_uri'+is+not+valid.+The+expected+value+is+''+or+a+URL+which+matches+the+redirect+URI+registered+for+this+client+application.&state=redirect_type%3dauth%26display%3dpage%26request_ts%3d1430410948914%26response_method%3durl%26secure_cookie%3dfalse

I have tried different options originally with localhost, but even when I load up a page onto a simple domain I get the same message.

I have tried variations of the redirect url- none appear to work.

My web page:

    <script type="text/javascript" src="" id="onedrive-js"
    <script type="text/javascript">
        function ShowOnedrivePicker() {
            var oneDrivePickerOptions = {
                success: function (files) {
                    alert( files[0].link + "  name:" + files[0].name);
                cancel: function () {
                    // handle when the user cancels picking a file
                linkType: "webViewLink",
                multiSelect: false
    <button onclick="ShowOnedrivePicker()">One Drive Picker</button>

I have registered and have a client ID, and have tried variations of the redirect URL in the API settings, such as,, and with no success.

While I have found many good solutions in Stack Overflow previously this is the first time I have asked a question. Thank you.


  1. 参考答案2
  2. 参考答案3
  3. @daspek I think it makes sense to let authenticate a user on a different callback URL. The main reason is that the OneDrive button could be simply used on the admin site of the site that's not accessible by anonymous users.

    I am currently implementing a new plugin for Drupal and content types are dynamically created and the URL paths look something like this:

    node/add/[type] where [type] could be article, page or any other name. So in order to be able to use the OneDrive picker plugin I have to add all those links to the App settings.

    Also the button doesn't work well on the second and Nth clicks. First click on the button triggers the popup but the following clicks won't.

    I was able to verify the issue today: I am using the most recent version of Chrome.

  4. 参考答案4
  5. I was struggling with the same problem and eventually I've found the solution.

    1. Development environment
      • you have to map your "fake" domain to the localhost
      • (in hosts file)
      • in Microsoft Applications settings you have to provide your redirect url, in this case should be like
      • if you're running Rails project therefore your application is running on the port 3000, you should provide this port into redirect url as well, therefore your redirect url should be like