OneDrive / onedrive-api-docs

Official documentation for the OneDrive API
MIT License
452 stars 229 forks source link

OneDrive picker redirects back to my site #1254

Closed Dave3of5 closed 1 year ago

Dave3of5 commented 4 years ago

I'm using the OneDrive Picker documentation from here but it doesn't work. Firstly I needed to add a redirect Url otherwise the login page that is opened says it can't log me in. Then what happens is that the page that is displayed is actually my website with an access token in the Uri:

Screenshot 2020-04-02 at 16 24 12

The code I'm using is almost exactly copied from the tutorial but I'll give it here:

launchOneDrivePicker: function(){ let odOptions = { clientId: "redacted" }; OneDrive.open(odOptions); } I think this is a config for my app but I can't figure out at all and the documentation doesn't mention this at all.

ghost commented 4 years ago

Thank you for your contribution to OneDrive API Docs. We will be triaging your incoming issue as soon as possible.

Dave3of5 commented 4 years ago

Anyone had a look at this the picker that I have at the moment it unusable and simply redirects to my webpage.

Dave3of5 commented 4 years ago

Two weeks and no comments at all ?

I've tried everything the docs are so confusing here and tell you basically nothing.

I'm trying to use the onedrive picker with an Spa (Vue.js) so having a predefined Url for redirect doesn't work. Are there any example / help on setting this up ? I'm really struggling.

shurshilov commented 4 years ago

I have exactly the same problem and I cannot understand what is the matter, is there any news?

shurshilov commented 4 years ago

onedrive I solved, just need understand different between implicit flow and auth code flow. Onedrive JS picker need use implicit flow! And it is also possible that I created a second spa application and tried to go through it, of course it did not work, you need a regular Web. But the cookies may have been erased!

vishuk570 commented 2 years ago

@Dave3of5 @shurshilov @chackman
I have the same issue. if you are solved it Please share the solution. Thank you

shurshilov commented 2 years ago

@Dave3of5 @shurshilov @chackman I have the same issue. if you are solved it Please share the solution. Thank you

I use like this

        // Create and render a Picker object
        createPickerOnedrive: function() {
            return new Promise((resolve, reject) => {
            var odOptions = {
                clientId: this.onedrive.clientId,
                //action: "download",
                action: "query",
                //action: "share",
                multiSelect: true,
                openInNewWindow: true,
                viewType: this.onedrive.viewType, //folders, files
                advanced: {
                    queryParameters: "select=id,name,size,webUrl,file,folder,photo,@microsoft.graph.downloadUrl",
                    createLinkParameters: { type: "edit" }
                },
                success: function (files) { resolve(files); },
                cancel: function () { resolve(null); },
                error: function (e) { console.log(e); reject(e); }
            };

            OneDrive.open(odOptions);
            });
        },

Video how setup https://www.youtube.com/watch?v=zqVUhQfbi_s&ab_channel=Eurodoocom

vishuk570 commented 2 years ago

I have use also like this but issue not fix. when I put credential of microsoft for access onedrive then redirect to in my web app.

martin19 commented 2 years ago

I had success adding an endpointHint like so to the picker options:

advanced: {
  endpointHint: "api.onedrive.com"
},
patrick-rodgers commented 1 year ago

As part of a repository clean up effort we are closing older issues. If this issue remains, please: open a new issue, reference this issue, and provide any additional details that may help in resolution. Thank you for your understanding as we work to improve our responsiveness.